Check memory allocation without valgrind

writing my own version of malloc () (and his best friend Mr. free ()), I need to know if I freed up my memory correctly. I can't seem to use valgrind because it checks libc'malloc and mine is in the shared library loaded by LD_PRELOAD.

Currently, if I use valgrind, it says: "0alloc 0free 0leak, all is well," because it does not detect the distributions I made with MY malloc. (I use brk () functions)

Does anyone know if there is a way to check with valgrind anyway or with another?

Thanks!

+4
source share
1 answer

, :

- -

- malloc() free(), --soname-synonyms, Valgrind . . :

--soname-synonyms=somalloc=mymalloclib.so

. http://valgrind.org/docs/manual/manual-core.html#manual-core.rareopts.

( API, malloc()/free()), " " malloc()/free(), Valgrind . . http://valgrind.org/docs/manual/mc-manual.html#mc-manual.mempools.

:-), , .

+1

Source: https://habr.com/ru/post/1525307/


All Articles