Summary:ASTERISK-00353: Memory Leak?
Reporter:richard (richard)Labels:
Date Opened:2003-10-03 23:22:26Date Closed:2008-01-15 14:35:56.000-0600
Versions:Frequency of
Environment:Attachments:( 0) callerid.diff
( 1) calleridv2.diff
Description:Asterisk CVS-10/03/03-15:53:40 Redhat7.3

Each time I dial into an X100P and then hangup after the call has been answered, the "SIZE" and "RSS" in the program top increment by 196 bytes for all asterisk threads. This also shows up in the program free:

                        used       free

-/+ buffers/cache:      59952     197688

-/+ buffers/cache:      60148     197492

Note: I am hanging up the call prior to the timeout hangup in the extensions.conf.


Relevant part of extensions.conf that the call arrives at:

exten => s,1,Answer
exten => s,2,DigitTimeout,10
exten => s,3,ResponseTimeout,20
exten => t,1,Hangup
Comments:By: richard (richard) 2003-10-03 23:27:40

Sorry, that should be 196kB not 196bytes - the machine has 256MB of RAM

By: Mark Spencer (markster) 2003-10-04 17:18:22

Have you turned on malloc debugging in the Makefile and then done "show memory"?  it should indicate where memory might be leaking.  look for numbers that increase each time you make a call.

By: richard (richard) 2003-10-04 21:10:20


The leak appears to be related to callerid.c. When I place the first call and hangup, this entry appears in the "show memory summary" list

197792 bytes in     1 allocations in file 'callerid.c'

After the second call:

395584 bytes in     2 allocations in file 'callerid.c'

"show memory allocations callerid.c" gives:

197792 bytes allocated in  callerid_new at line   112 of callerid.c

My zapata.conf is :

channel => 1-2

When I add usecallerid=no to the above, all is well again.

Adding usecallerid=yes brings the leak back.

Thanks for the help.

edited on: 10-04-03 21:19

edited on: 10-05-03 13:36

By: James Golovich (jamesgolovich) 2003-10-07 15:33:35

I'm going to guess that this is a callerid leak that I detected a while ago.  I fixed it on my box but I didn't get someone else to test it so I never submitted it.  I'll dig it out, retest it and submit it here to see if it fixes the problem.

By: Thorsten Lockert (tholo) 2003-10-08 10:20:30

I have uploaded a patch that fixes this memory leak...  It also fixes a minor issue where, if a memory allocation failed, an attempt was still made to zero the allocated area, causing a crash.

By: Mark Spencer (markster) 2003-10-08 16:29:53

Fixed in CVS

By: Digium Subversion (svnbot) 2008-01-15 14:35:56.000-0600

Repository: asterisk
Revision: 1621

U   trunk/callerid.c
U   trunk/channels/chan_zap.c
U   trunk/frame.c

r1621 | markster | 2008-01-15 14:35:55 -0600 (Tue, 15 Jan 2008) | 2 lines

Callerid fix and warning cleanup (bug ASTERISK-364 & ASTERISK-353)