1 year ago

#369823

test-img

Le Rui

Valgrind reports memleak of same type on 3 blocks

Currently working on a project for a database, and using valgrind I already took out most of the leaks. However, at the end, using --leak-check=full and -s, it reports that I am still losing around 700 bytes on 3 blocks. I get that it's saying that those 3 blocks of leaks are happening due to the same issue, but I want to know exactly where on the test file these happen.

For example, as you do, I am freeing a whole array of allocated structs, but maybe 3 of them are not properly doing so. If so, I want to check at which index those mallocs dont get their proper free, so I could recognise the pattern and fix it. Valgrind shows the code lines with the lost malloc'd memory, but not really when they happen.

Is there a way to do that in valgrind?

c

valgrind

0 Answers

Your Answer

Accepted video resources