[OpenSER-Devel] Memory leak (probably in custom module)

William Quan wiquan at employees.org
Wed Oct 3 18:25:49 CEST 2007


I found these instructions to be very helpful. It documents the steps to
rebuild things with instrumentation needed to debug these things.
-will

http://openser.org/dokuwiki/doku.php/troubleshooting:memory

Ardjan Zwartjes wrote:
> Good morning developers,
>
> I'm currently developing some custom openser modules, which is going
> fine, except for the fact that I seem to have introduced a memory leak
> somewhere. After some time of running, openser stops functioning and
> keeps giving "out of memory errors". 
> Following the pointers on
> http://www.openser.org/dokuwiki/doku.php/troubleshooting:memory#how_to_h
> andle_it I have compiled openser and my modules with DBG_QM_MALLOC to
> generate the memory logging. I restarted openser, placed one call using
> my modules and waited for 20 minutes before sending  a SIGUSR1 signal to
> one of the SER threads. This gave me about 1800 lines of extra logging
> showing 143 alloc'ed fragments in SHM and 469 in PKG. My guess is this
> isn't good ;). The problem is that none of the alloc'ed fragments is
> alloc'ed from my own code.
> My guess is that I'm forgetting to free some memory alloc'ed by an API
> call, but I'm clueless on how to find the place in my code where I make
> this call. I checked to see if the memory is alloc'ed from a single
> location, but unfortunately that is not the case. There are however some
> locations that have a lot of alloc'ed fragments left, I've put the top 3
> below.
>
> cfg.lex: addstr(785)			(137 fragments)
> route_struct.c: mk_action(104)	(108 fragments)
> Route_struct.c: mk_exp(53)		(55 fragments)	
>
> Can somebody give me any pointers on how to locate the origin of this
> memory leak? Are the lines mentioned above used in a common API call
> which leaves memory to be freed? Any help would be greatly appreciated.
> If needed, I can put the complete memory log online, but my guess is
> that there aren't that many people interested in going through 1800
> lines of memory logging ;).
>
> Kind regards,
> Ardjan Zwartjes
> Telecats BV
>
> -----
> Ardjan Zwartjes | R&D Consultant | Telecats bv | KvK Enschede 06069106 |
> Tel:053 488 99 18 | Fax: 053 488 99 10 | E-mail:
> ardjan.zwartjes at telecats.nl |
>
> _______________________________________________
> Devel mailing list
> Devel at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/devel
>   




More information about the Devel mailing list