Hello all.

I am trying to find memory corruption using valgrind/memcheck.
I am running a big executable, and noticed that memory access outside allocated 
areas is not detected. This happens after very many memory allocations are 
performed.
I am testing access to illegal memory and finding that access to memory beyond 
the boundaries of memory just allocated by malloc is not reported.
Access to memory after it is freed by free() is not reported.
Access to memory which is not mapped in virtual memory is reported.

This is not due to too many errors, and I suspect that the valgrind data 
structures holding allocations and de-allocations get full, and therefore stop 
functioning. This is just a guess, I have no information about the mechanism. I 
do know that the executable uses a big amount of memory allocations.

Is there a way to check print the  memory allocations and de-allocations that 
valgrind is tracking at a specific point?
Is there a limit to the number of allocations that can be handled?

I am running on Linux x86_64.
I tried using both valgrind-3.8.1 and valgrind-3.5.0 that comes with the open 
Suse 11.3 I am running on.
I tried this with both a 32 bit and a 64 bit executable.
Example command line that I use:  valgrind --trace-children=yes 
--error-limit=no -v ./executable

Does anyone have an idea what to do here?

FYI Here is the code I am using to test the illegal memory access detection, 
where p is a pointer to 32 bit integers.

    if ((p = malloc(24))) {
        int i;
        for (i=0; i<=5; ++i) {
          p[i]=i;
        }
        p[0]=p[6]+p[7]+p[8];
        p[1]=p[-1]+p[-2]+p[-3];
        printf("freeing %p\n", p);
        free(p);
        p[1] = p[0];
    }

TIA,
Gili


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to