Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Does undef free ram?

by Abigail-II (Bishop)
on Jul 17, 2002 at 12:19 UTC ( [id://182398]=note: print w/replies, xml ) Need Help??


in reply to Re: Does undef free ram?
in thread Does undef free ram?

Forking after using the array (regardless whether you undef it first) only makes the problem worse, now you have doubled the memory usage. Letting the parent die just makes you back at the previous memory usage.

There is a "famous" trick, used by long running processes to prevent possible memory leakage from sucking up all the resources, but that doesn't use fork, it uses exec. execing yourself means that you are restarting yourself - starting with a fresh sheet of memory. Obviously, this is not going to work for many programs.

Abigail

Replies are listed 'Best First'.
Re: Re: Does undef free ram?
by Anonymous Monk on Jul 18, 2002 at 00:26 UTC
    What you say is true. However for many purposes it also works to fork before doing whatever will take memory. Then the bloated child who used memory can exit, leaving the parent lean and trim.

    Doing work within system calls can help for the same reason.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (None)
    As of 2024-04-25 00:51 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found