|
From: Brian A. <ba...@we...> - 2003-11-07 13:36:14
|
I have an apache 2 module which I suspect is leaking memory, but valgrind never reports it. To test this I included "valgrind/memcheck.h" and call VALGRIND_DO_LEAK_CHECK for every request in this module. Valgrind does a memory leak test, but doesn't seem to catch anything in this modules. Example: char *p; p = malloc(128); p = NULL; This never gets caught. Any suggestions. This is apache 2.0.48, threaded, Debian unstable, valgrind 20031012 Thanks -- Brian Akins <ba...@we...> CNN Internet Technologies |
|
From: Nicholas N. <nj...@ca...> - 2003-11-10 20:33:22
|
On Fri, 7 Nov 2003, Brian Akins wrote:
> I have an apache 2 module which I suspect is leaking memory, but
> valgrind never reports it.
>
> To test this I included "valgrind/memcheck.h" and call
> VALGRIND_DO_LEAK_CHECK for every request in this module. Valgrind does
> a memory leak test, but doesn't seem to catch anything in this modules.
>
> Example:
>
> char *p;
>
> p = malloc(128);
> p = NULL;
>
> This never gets caught.
I just tried this with a small test program:
#include <stdlib.h>
#include "memcheck.h"
int main(void)
{
char *p;
p = malloc(128);
p = NULL;
VALGRIND_DO_LEAK_CHECK;
return 0;
}
And the leak was found:
==22840== searching for pointers to 1 not-freed blocks.
==22840== checked 3534372 bytes.
==22840==
==22840== 128 bytes in 1 blocks are definitely lost in loss record 1 of 1
==22840== at 0x400296A6: malloc (vg_replace_malloc.c:153)
==22840== by 0x80483FD: main (a.c:8)
==22840== by 0x40242A06: __libc_start_main (in /lib/i686/libc-2.3.2.so)
==22840== by 0x8048298: ??? (start.S:81)
Can you give us a sample program, the smaller the better, that exhibits
the problem?
Thanks.
N
|