How do i debug Memory leaks
First time I'm seeing a memory. It looks like my FreeMem() function delete(void*) is the problem ? would that be correct
14 Replies
Just give up
jk valgrind tells you where the leak occurs, not where it originates from
You kinda just gotta read your code, and make sure theres a
delete
for every new
thats the only way memory leaks can occur right? if i just don't delete for every new?
pretty much
valgrind also catches some other things, like not properly initializing a var before using it and stuff
if i see 13 errors in context 1 of 2 and 2 of 2 does that mean theres two instances where i didn't delete?
or is there 13 times that i didn't delete?
@themagicguy thanks for the help i found my memory leak
Hello everyone, I am also getting same error, Can you tell where the leak is ?
Only you are supposed to notice where the memory leak is
If you are compiling in matrix, try to compile with the
-g
option
Valgrind will use debugging information included in the executable to pinpoint more exactly where the leak isCan you send the whole compile code of matrix?
What do you mean exactly by "whole compile code of matrix"?
The one with -g
I didn't get that
Compile it your self lol
You can compile it... Aren't you using g++ command to compile?
Yes, but I'm not able to find the memory leak problem
Look harder?
Idk what else to say
Yeah, you just have to read carefully your source code. There's no other solution to this