Summary:ASTERISK-00583: Memory leaks in channel drivers (so many to say exactly)
Reporter:Paul Cadach (pcadach)Labels:
Date Opened:2003-11-27 13:53:49.000-0600Date Closed:2011-06-07 14:11:59
Versions:Frequency of
Description:At load_module(), many channel drivers creates io_context and sched_context structures for doing channel monitoring. But when module unloads memory allocated for those structures are not freed (by io_context_destroy() and sched_context_destroy()).


egrep "_context_create|_context_destroy" *.c results are:
chan_h323.c:            sched = sched_context_create();
chan_h323.c:            io = io_context_create();
chan_iax2.c:    io = io_context_create();
chan_iax2.c:    sched = sched_context_create();
chan_iax.c:     io = io_context_create();
chan_iax.c:     sched = sched_context_create();
chan_mgcp.c:    sched = sched_context_create();
chan_mgcp.c:    io = io_context_create();
chan_sip.c:     sched = sched_context_create();
chan_sip.c:     io = io_context_create();
chan_skinny.c:  sched = sched_context_create();
chan_skinny.c:  io = io_context_create();
Comments:By: Brian West (bkw918) 2003-12-02 16:56:11.000-0600

Can you provide more proof than this?  More details always help.

By: Paul Cadach (pcadach) 2003-12-02 22:46:11.000-0600

I want to say that at unload_module() calls to io_context_destroy(io) and sched_context_destroy(sched) are required to free memory used by io and sched structures previously allocated at load_module(). As for me when I playing with modules (modifying them) and don't want full restart of Asterisk, I've just unload <module> then load <same module>.

Brian, I have opened ticket ASTERISK-454 about cleaning up at unloading for modules. Modified patch (now - cumulative) for current CVS attached to ASTERISK-454.

edited on: 12-02-03 23:38

By: Brian West (bkw918) 2003-12-05 18:19:18.000-0600

sweet thats the info I needed so I could see the logic behind your reasoning.  I will present this to Mark and see what he says.


By: Brian West (bkw918) 2004-02-01 11:33:58.000-0600

Get me more info and we will reopen this.