[Serdev] Finding a memory leak

Michal Matyska michal at iptel.org
Thu Apr 13 14:49:42 UTC 2006


On Wed, Apr 12, 2006 at 05:34:09PM +0200, Andrei Pelinescu-Onciul wrote:
> On Apr 12, 2006 at 13:57, Pupeno <pupeno at pupeno.com> wrote:
> > Hello,
> > I am trying to see if my module for SER has a memory leak, so I've set
> > memlog to 2 and now I have tons of messages about memory.
> > Doing a bit of search I've found things such as:
> > 
> >  2(12621)     403. N  address=0x813b3d8 frag=0x813b3c0 size=4 used=1
> >  2(12621)             alloc'd from dialplan.c: mod_init(199)
> >  2(12621)         start check=f0f0f0f0, end check= c0c0c0c0, abcdefed
> > 
> > but as far as I know this is not sign of a memory leak, right ?
> 
> This means this fragment is still allocated at the time of the dump.
> If this "memory dump" happened on ser shutdown, it means that nobody
> freed this fragment. This could be a memory leak or a harmless missing 
> free on  ser exit/mod destroy.
> For easier debugging and saner code is recommended to free all the
> memory allocated during init (mod_init, init_child) in the module's
> destroy function.
 
Yes indeed, but there is one "exception" to the rule present at the moment:

if you start ser with -c parameter to check the config file, the
mod_exit function is beeing called (due to the signal handling, when ser
exits), while the mod_init/child_init were NOT called (and some script
errors, which show up at mod_init/child_init, won't be discovered).

I consider this as BUG and I've posted it few minutes ago.

Michal.




More information about the Serdev mailing list