Forcefully release release to OS
am 04.01.2008 14:14:38 von Nishant
Hi ,
In my software, perl is using memory that it is not releasing and the
size of the memory that it has allocated is 100MB.
Is there any API with which I can forcefully do garbage collection so
that perl is forced to release memory to OS ?
Regards
Nishant
Re: Forcefully release release to OS
am 04.01.2008 14:39:44 von Joost Diepenmaat
Nishant writes:
> Hi ,
> In my software, perl is using memory that it is not releasing and the
> size of the memory that it has allocated is 100MB.
> Is there any API with which I can forcefully do garbage collection so
> that perl is forced to release memory to OS ?
It doesn't work that way.
Perl has a reference counting GC so all objects that are not available
anymore will be freed /immediately/. Unless you're dealing with circular
references, which you need to break before letting them go.
_This may or may not actually free memory to the OS._ You'll have to
test it yourself.
/Sometimes/ undefining variables manually before letting them go out of
scope frees the memory all the way to the OS even if they otherwise aren't.
But I already said that in your previous thread.
Note that all of this is dependent on you actually letting go of the
variables, just like it is in any language with automatic mememory
management. In other words, if the values are still accessible in any
way they can't be collected.
Joost.