Hi all,

I'm running into a wee memory problem. Basically I'm working on a perl project, webmake, which, keeping it simple, does the following: it maintains a list of content items (think files), does all manner of substitutions on them, and writes them to an output directory. It also tracks their dependency graphs so it knows what to rebuild next time around.

This is modelled as a hash containing instances of a Content class; each of these contains a member containing the filename (string), and another hash, mapping dependency filenames (string) to a modification date (integer).

The problem is, when it runs with a 5000-file data set, it's taking up a hefty chunk of RAM; at peak it hits about 50megs. I think the 5000 instances of the latter hash is a big part of this.

Typically a Content item contains 1 dependency. Is there any way, or any alternative Tie:: implementation, that can handle a 1-element hash in a minimum amount of RAM?


In reply to tuning hash memory usage by jmason

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.