memory leak

Till Straumann strauman at SLAC.Stanford.EDU
Wed Feb 12 01:47:30 UTC 2003


Joel Sherrill wrote:
> 
> Stan wrote:
> 
>>Hi,
>>
>>How to detect memory leak ?
>>At some point, my application is  freeze.
>>STACK_CHECKER_ON is defined, but
>>no message to appear.
> 
> 
> This only checks at context switch time so if you blow the stack
> too badly in between them, then nothing will be detected.
> 
> You could insert calls to check the stack in your task loops so
> you are not depending on a context switch to occur.
> 
> If you can look at memory after it freezes, you can check stacks 
> pretty easily by hand.  It should be fairly easy to write
> a gdb macro to do this also.
>  
> 
>>I don't use malloc/free.
> 

You most likely _do_ use malloc/free [indirectly].
E.g. if you open a file and fail to close it, you
end up with a memory leak (because libio uses malloc/free).

Many system services use the heap extensively and hence you
create memory leaks if you don't properly release system
resources (+ the system itself might have memory
leaks, although probably not very aggressive ones).

-- Till.

> 
> That eliminates all that possible detection. :)
> 
> 
>>Thanks.
>>
>>        Stan .
> 
> 






More information about the users mailing list