develooper Front page | perl.perl5.porters | Postings from January 2001

Maximum size of a (dbmopen-style) tied hash?

Thread Next
From:
Rich Morin
Date:
January 14, 2001 19:44
Subject:
Maximum size of a (dbmopen-style) tied hash?
Message ID:
p05001933b6880d0a9eac@[192.168.168.205]
You may recall my question about "finding out the number of entries
in a hash".  In playing with this same monster hash, I decided that
I should make all of my entries into fully compliant XML.  That is,
instead of "<foo>bar</>", I would store "<foo>bar</foo>".

Not surprisingly, this increased the size of the hash (from 86+ MB
to 140+ MB).  I might have been willing to accept this, but it also
managed to break something (down in the tied hash code), causing the
program to crash.  So, I went back to the shorthand encoding (:-).

I would like to know, however, exactly what limit I ran into, and
where I should have found it documented.  FWIW, I am using perl
5.005_03, built for i386-freebsd 4.1.  Here are some test runs:

   dbmopen(%m, 'sizetest', 0600);
   for ($i=0; ;$i++) { $m{$i} = '.'x1000; }
   ...
   ndbm store returned -1, errno 0, key "85687" at tst_dbm line 14.
   -rw-------  1 rdm  meta  587165696 Jan 14 18:56 sizetest.db


   dbmopen(%m, 'sizetest', 0600);
   for ($i=0; ;$i++) { $m{$i} = '.'x2000; }
   ...
   ndbm store returned -1, errno 0, key "28899" at tst_dbm line 14.
   -rw-------  1 rdm  meta  167030784 Jan 14 19:31 sizetest.db

   dbmopen(%m, 'sizetest', 0600);
   for ($i=0; ;$i++) { $m{$i} = '.'x4000; }
   ...
   ndbm store returned -1, errno 0, key "17844" at tst_dbm line 14.
   -rw-------  1 rdm  meta  307195904 Jan 14 19:43 sizetest.db

Suggestions?

-r
-- 
--
http://www.cfcl.com/rdm
email: rdm@cfcl.com
phone: +1 650-873-7841

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About