Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Well. This piece of code should simulate what goes on when tied hash is used. I have tied hash to PostgreSQL database so key-value pairs are stored in database and does not reside in memory. Because stored values are deeper structures (in most simpliest case the stored value is list of Set::Scalar objects) there is the Storable module used for converting to the scalar.

There is nfreeze called when storing value to the database and thaw when data retrieval from it. I expect that all temporary variables are freed when goes out of scope, but it looks like not. procinfo function is called when all variables ($tmp, $r_arr, $set and $scalar_set) are out of their scope and so I expect that displayed values should be the same...

My big problem is memory compsumption when I iterate through all keys in this tied hash. For relatively small piece of test data the first iteration cost about 750 MB and each other cycle causes perl to require about 200 MB more! So after third cycle is allocated more than 1GB!!!

Simple empty loop with this tied hash which causes memory compsumption...

while (my ($key, $value) = each %data) { ; }

In reply to Re:^2 Storable: where is my memory? by ph0enix
in thread Storable: where is my memory? by ph0enix

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2023-12-02 17:56 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (18 votes). Check out past polls.