[erlang-questions] Memory management

Ladislav Lenart lenartlad@REDACTED
Thu Apr 26 18:39:07 CEST 2007

Per Gustafsson wrote:
> When a process is created in Erlang it has a Heap consisting of 233 
> words. When this space has been exhausted a garbage collection is 
> performed and if the live data takes up more than 75 % of the total heap 
> size then the size of the heap is increased (To the next fibonacci 
> number) and if it takes up less than 25 % of available heap space the 
> heap size is decreased.
> (The 75% and 25% figures are not necessarily correct and a process heap 
> newer shrinks below 233 words)
So the memory consumption during a test run of our application means
that there is 800MB of data that can not be GC'ed. Oops. So there is
definitely something wrong with the appliation... :-(

> Thus the heaps for each process are growing and shrinking as the program 
> executes. This is necessary for a system which handles hundreds of 
> thousands of processes because if each process had a fixed heap size 
> then if the process which has most live data uses S words and there are 
>  N processes the system would use S*N words.
Yes, this seems reasonable. I was just thinking that there could be
a threshold for the GC to "start bother" in which case there could
be 800MB of garbage in our running application... :-)


Ladislav Lenart

More information about the erlang-questions mailing list