[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Memory Management in Linux

On Friday 05 November 2004 12:37, Silvan Villiger wrote:

> My goal is to write a script to monitor the memory-usage of a program
> and to detect memory-leaks using the ps-command. How would you detect
> memory leaks with it?

You wouldn't.  A memory leak, in a nutshell, is a call to malloc() without a 
corresponding call to free() sometime afterward.

It'd be approximately impossible to deterministically tell from the outside 
whether a program is truly leaking memory, or whether it was simply 
delaying the free() call until some later time.  If have access to the 
program's internals, you can probably get a much more accurate answer.
Kirk Strauser

Attachment: pgpUno8b4o9if.pgp
Description: PGP signature

Reply to: