[asterisk-dev] Query on Memory Management Guidelines

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Mon Jul 23 07:04:23 CDT 2007


On Monday 23 July 2007, Grey Man wrote:
> One test I did on my patch was to turn on the MALLOC_DEBUG flag and use
> "show memory summary app_dial.c" before and after a call. In doing so I was
> seeing an increase per call of approx. 64 bytes. As best as I could tell
> (and I could be very wrong so please excuse me if so) the problem was not
> down to my modifications but to line 1593 in app_dial.c:
>
> struct ast_bridge_config config;
> memset(&config,0,sizeof(struct ast_bridge_config));
>
> I could not find anywhere this memory was being released and changing to
> the ast_calloc mechanism above seemed to remove the leak. Any advice or
> beatings would be appreciated.

This allocates memory not off the heap, but off the stack.  The memory is
subsequently freed (or, really, goes out of scope) when the function returns.
This is unlikely to have been the cause of your memory leak.

-- 
Tilghman



More information about the asterisk-dev mailing list