[erlang-questions] Memory Leak

Gordon Guthrie <>
Wed May 27 08:46:52 CEST 2009


Andrew Mmc wrote:

> What is the best way to find out what is going on and what the cause of this
> leak is?

erlang:processes/0 will return a list of erlang processes

You can use erlang:process_info/2 to introspect them for a number of
different things

erlang:process_info(PID, [total_heap_size, message_queue_len]) is
probably the right place to start.

We track memory problems by using a tick function that looks at alive
processes every 10th of a second, sorts 'em on heap size and then logs
the top 5 memory hogs to a disk file.

Graph it up in Excel and job's a good 'un.

Other things you might want to log are total number of processes which
you can get by length(erlang:processes()) or using
erlang:system_info/1 with appropriate parameters.

Gordon

On Tue, May 26, 2009 at 2:10 PM, andrew mmc <> wrote:
> Hello, all,
> I have a system that involves spawning lots of processes to work on the same
> set of data.  Each process reports to one of a number of listener processes
> that collate the results and determines the next bit of work to do.  There
> is also a fair amount of inter-process communication.  I have found that
> pretty quickly, erlang runs out of memory.
> What is the best way to find out what is going on and what the cause of this
> leak is?
> Thanks for your help,
> Andrew
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list