[Spread-users] Possible memory leak in spread ?

Jonathan Stanton jonathan at cnds.jhu.edu
Thu Jun 27 00:08:51 EDT 2002


It could be a memory leak, but I would be a bit suprised as after fixing a
few several version ago, I havn't heard any reports for awhile.

One thing to be aware of is that Spread does not just use malloc/free
directly, but rather has it's own memory management system implemented in
memory.c that caches allocated memory and reuses it instead of 'free'ing
it. This is done for both debugging and performance reasons. If you look in
the memory.c file you can see some of the built in memory leak detection
code. The spread monitor can also print a report of used memory which is
helpful in finding leaks. 

You are correct that if under normal use spread continually uses more and
more memory that is likely to be a leak, however if you are actually using
it 'harder' then increased memory usage is an expected behavior. Spread
increases the number of buffered messages as the load on teh system
increases. Several other memory resources also increase as the system is
used more, but these are not leaks as they will no increase forever (there
is a coded in max usage) and they will be freed when the caches in Spread
are released.

Jonathan

On Tue, Jun 25, 2002 at 08:14:14PM +0400, Muthal Sangam wrote:
> I used the following method, which i am not too sure is correct. i used ltrace
> util
> to monitor calls to calloc,malloc,free. I note the address returned by
> calloc&malloc
> and remember the corresponding size. At free, i lookup the address and find the
> size. calloc&malloc adds to memusage, free subtracts. Now, if memusage keeps
> on increasing under a steady load, does it mean that there is a mem leak. If yes
> then there could be leak in spread. I had a test program, 
> connecting/joining/mcasting/exiting a group and memusage slowly kept increasing.
> 
> Some libc funcs(strdup for eg) internally allocate mem and expect user code to
> free 
> it via free(). I ignore a free of an address which has not been seen before.
> Note 
> that the malloc done by strdup would'nt show as well. I would like to know
> whether 
> my method is wrong. If no then i can try to trace the leak.
> 
> - sangam
> 
> 
> 
> _______________________________________________
> Spread-users mailing list
> Spread-users at lists.spread.org
> http://lists.spread.org/mailman/listinfo/spread-users

-- 
-------------------------------------------------------
Jonathan R. Stanton         jonathan at cs.jhu.edu
Dept. of Computer Science   
Johns Hopkins University    
-------------------------------------------------------





More information about the Spread-users mailing list