Various dbm algorithms will free space by marking sections as free and then reuse that space on need. So just because you are adding data doesn't mean that it will need to grow.
However you should know that SDBM_File is the worst of the dbm options available in Perl. It has a number of nasty limits, most importantly key/value pairs cannot exceed a fairly small size. If you can I strongly recommend using DB_File or GDBM_File. (I also recommend keeping a backup in plain text, but that is another story.) | [reply] |
It's the chunks, and then some. A hash file is going to have empty space all over it. When you insert something, the hash algorithm picks a more-or-less random block to store it in. Only if that block happens to be full already will the file grow.
OTOH, I've heard of hash algorithms that have problems when too many keys map to the same block. That has the effect of limiting your maximum file size, but the maximum size isn't something easy to compute. When in doubt, dump the values back out of the file to make sure they're really in there. | [reply] |