There are 2 layers here to understand. The first is MLDBM, and the second is GDBM_File.

What MLDBM does is take care of stringification and de-stringification of complex data structures. That is you read back a key/value pair, and then MLDBM turns that value to/from a nested Perl data structure. You could do the same thing that MLDBM does if you tied straight to GDBM_File and then used Storable to freeze/thaw your data after reading/before storing. If your datastructures for a single key/value get very large, this could be a problem. If they are not large, it isn't. If you're concerned by that, then you could look at DBM::Deep.

The real question is GDBM_File. That is a Perl interface between Perl and the GNU dbm implementation. That is the internal implementation that decides how much memory to read in, use, etc. You'll have to read the gdbm man-page to find out how it uses shared memory, etc. Odds are good that it uses some multi-level caching system, and caches in RAM. But I don't know anything about the size of those caches, how to tune it, etc. I don't know anything about that, but I'd guess that its memory use is relatively limited.

Another thing to try is that you could run it and watch memory usage with standard tools (like top and ps). That does not give a definitive answer, but it gives you a good idea of what the usage looks like.

In reply to Re: MLDBM and Memory by tilly
in thread MLDBM and Memory by NormalPerson

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.