[erlang-questions] Memory management

Per Gustafsson per.gustafsson@REDACTED
Thu Apr 26 16:13:18 CEST 2007


Ladislav Lenart wrote:
> Hello,
> 
> During testing of our application we found that a larger instance
> consumes about 80% (800MB) of system memory when it is actively doing
> something. When it is only "loaded" but not started (all the processes
> are there but no messages are sent), it consumes about 11% of system
> memory. We have no idea what can make for such a big difference so
> we started to wonder how does the erlang runtime decide to perform
> a GC?
> 
> Thanks,
> 
> Ladislav Lenart
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions

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)

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.

Per



More information about the erlang-questions mailing list