Re: About Eu garbage collection

new topic     » goto parent     » topic index » view thread      » older message » newer message

Henri Goffin writes:
> Here's my problem. A program I am working on makes 
> use of huge sequences. Some of them - the biggest ones - 
> are just used temporarily. So I thought naively that when 
> the routine was done extracting useful data from thoses 
> big sequences it would suffice to make 'huge = {}' to 
> free up memory. But nope.

How do you know that the space is not freed?

> It seems that once memory has been dynamically 
> assigned to sequences there is no way to free 
> it until the program is done. Am i right?

No.

The values (atoms or sequences) that are currently 
assigned to variables in the program must (obviously) be retained.
Other values are freed. For instance,
when a routine returns, the space assigned to its private
variables is released. When any variable is assigned a new
value, the space used by the previous value is released.

When space is released it goes to the "heap"
where it can be used again by your program.

Memory is not returned to the *operating system*,
until your program terminates, so if you are 
trying to measure memory usage with some system tool,
you will never see a decrease in the memory used
by your program. Giving memory back to the O/S
during execution of a program is expensive, complicated, 
and can't always be done. The normal practice is to free
memory to a heap, where the same application can 
use it again.

When you are dealing with huge sequences you may
also face the problem that there is not enough contiguous
space for your sequence. e.g. There might be 10 1Mb blocks
of memory available, but you need 1.5Mb.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu