> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> Boris Villazon
>
> When you insert a key/value into a DBM and that pair already exists:
> if the value is less than or equal to the existing value, the
> space is reused,
> else new space is allocated and the old space is not reclaimed.
This is standard behavior on *nix machines (AFAIK). Once they claim space
on disk, they do not release it.
>
> The delete() function does not help at all. If you loop over a DBM and
> delete all key/values, and then replace them with the same pairs, there
> is
> no change in the file size.
Internally, you release space in the file for re-use, but it is not
reflected on the external size of the file. You must unlink the file and
then recreate the DBM.
I once had a M$ Outlook pst file stored over a network share. Once, I was
gone for a vacation and 2 weeks of email piled up and the file grew large.
Once I cleaned out the file, the end size did not change. It required a
'compress Inbox' to reclaim the disk space. The compress is a simple, Copy
to temp, unlink, recreate and copy back active records only.
>
> However if you delete all pairs, close the DBM and reopen it and
> reinsert
> all key/value pairs, the DBM file size doubles.
>
> If you delete all pairs and insert new ones with slightly larger value
> sizes you more than double the file size.
which DBM are you using? I was under the impression the SDBM always
allocated a specific byte count per record, but I could be wrong.
>
> In a few words, the dbm file size grows and grows.
>
> Any suggestions about it?
Is this process of removing all pairs and adding them back frequently done?
If so, then consider 'unlink'ing and rebuilding the DBM.
Have you tried the same problems on a Win32 machine? It is a 'feature' of
the way file manipulation of the DBM is being done.
HTH,
Adam Frielink
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs