Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^5: No garbage collection for my-variables (possibilities)

by tye (Sage)
on Sep 16, 2008 at 21:00 UTC ( [id://711800]=note: print w/replies, xml ) Need Help??


in reply to Re^4: No garbage collection for my-variables
in thread No garbage collection for my-variables

But it wouldn't be terribly hard to implement some improvements here.

Perl could keep a LRU of still-allocated but unused "large" SVs and periodically free ones that haven't been re-used in the last period of time.

Note that what might look like the easiest "fix", freeing SVs for lexical variables if they are above a certain size, could have serious draw-backs, at least on some systems. Having done something like this on Win32, this can be a great way for heap fragmentation to cause your process to run out of virtual memory. Perhaps most other systems have smarter malloc()s and so aren't susceptible, but I'm not certain of that.

It also might be tricky to pick the proper parameters for what consistutes "large" and what the right minimum duration should be before the large allocation is declared "unlikely to be re-used" and free()d.

- tye        

  • Comment on Re^5: No garbage collection for my-variables (possibilities)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://711800]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-04-19 23:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found