[ejabberd] eheap memory allocation crashes

Andre Pang ozone at algorithm.com.au
Thu May 25 04:43:31 MSD 2006

Hi all,

I'm getting crashes with ejabberd/Erlang with the following error  

   Slogan: eheap_alloc: Cannot allocate 153052320 bytes of memory (of  
type "heap").

where the big number there varies, sometimes it's way above 200MB.   
It seems that other people are experiencing this problem as well:


I've had a look at the erl_crash.dump files, and here's the memory  

  total: 259359320
  processes: 251805409
  processes_used: 251800081
  system: 7553911
  atom: 354385
  atom_used: 350441
  binary: 16444
  code: 2914337
  ets: 3870916

We're running a pretty lightweight ejabberd setup: there's typically  
no more than about 5 users online at once, so I suspect there's  
something way wrong with the amount of memory used for processes.  If  
I add up the stack and heap usage for each process, I only get get  
24MB used:

  % egrep 'Stack\+heap' erl_crash.dump | awk '{ s += $2 } END { print  
s }'

So, are there any ideas on where the extra ~220MB of process memory  
is coming from?  The =allocated_areas section shows normal memory  
allocation figures except for processes again, which is ~250MB.  By  
far the biggest memory process is ejabberd_router, which was being  
garbage collected at the time:

  State: Garbing
  Name: ejabberd_router
  Spawned as: proc_lib:init_p/5
  Spawned by: <0.228.0>
  Started: Sat May 20 10:16:04 2006
  Message queue length: 0
  Number of heap fragments: 0
  Heap fragment data: 0
  Link list: [<0.68.0>, <0.228.0>]
  Reductions: 92793836
  Stack+heap: 24488375
  OldHeap: 0
  Heap unused: 8435749
  OldHeap unused: 0

Is it possible there's a memory leak in ejabberd_router somewhere?

Also, is it possible to force Erlang to write a erl.dump file at  
all?  Maybe it'd be beneficial to compare the normal running state  
with the crashed state.  Also, I think we were only getting these  
crashes after upgrading from ejabberd 0.9.8 to 1.1.0.

The full erl_crash.dump file is available at <http:// 
www.algorithm.com.au/files/erl_crash.dump.gz>.  Any help would be  
greatly appreciated, cheers!

% Andre Pang : trust.in.love.to.save  <http://www.algorithm.com.au/>

More information about the ejabberd mailing list