Forcefully release release to OS

N

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
 
J

Joost Diepenmaat

Nishant said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top