[erlang-questions] how to debug memory leaks?

Ulf Wiger <>
Sat Dec 4 16:50:37 CET 2010


On 4 Dec 2010, at 16:40, Attila Rajmund Nohl wrote:

> Ah, I have a GREAT story about this. We've received TRs that our
> program was crashing. It turned out that the Linux OOM-killer was
> killing some of our processes, because the OS ran out of memory. We
> saw that the process heap of some processes were quite big (tens of
> MBs), but calling erlang:garbage_collect(Pid) on them decreased it to
> the KB range - which was really strange.

<good story snipped/>

The reason why processes can remain large without getting GCed, is
that they have probably just increased their heap size dramatically in
order to store a very big term - heap size being increased in fibonacci
steps, so possibly allocating more space than stricly necessary - and 
after that, not done enough processing to fill the heap with garbage, 
triggering another GC.

BR,
Ulf W

Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com





More information about the erlang-questions mailing list