how to check memory leak in C program under Unix

Hi,

How to detect memory leak in C program under unix ?

Thanks

Valgrind is one of the few tools which helps you detect memory leak.

Also the env. variables MALLOC_CHECK_ and MALLOC_TRACE help to detect some. See man malloc for more details.

the ps command may show the program growing.
Depending upon your UNIX, you may have better tools (eg. HP's glance for HP-UX and Solaris, and Solaris 10's prstat).

Professional tools like "purify" do a good job.

On Solaris, use dbx RTC (Sun Studio) and/or libumem.

have a look

mtrace, dmalloc and memwatch