Re: Strangest bug I've ever seen
Posted: Wed Jun 24, 2020 1:18 am
It doesn't look like you're missing anything to me.
But in the first image, I notice that you can't see the value of
In my experience, these sorts of errors are nearly always false-positives. Like the actual error is elsewhere in the code, you're overwriting an array, or using after free, or something; and this is just a symptom. I'm not sure what the equivalent tool on Mac is, but something like valgrind (Linux and I think Mac?), or Dr Memory (Windows/Linux) would show the original error. Google has an Address Sanitizer tool that does the same stuff.
Basically all these tools do is highjack the memory and tell you exactly where you're overwriting bounds or double deleting or something like that. They detect leaks as well.
You could also try enabling more compiler warnings. Finally, CPPCheck does a good
But in the first image, I notice that you can't see the value of
testWTF
. In the second image I can see that testWTF
is NULL
but testWTF_again
is seated correctly. In the first image, is testWTF
also NULL
?In my experience, these sorts of errors are nearly always false-positives. Like the actual error is elsewhere in the code, you're overwriting an array, or using after free, or something; and this is just a symptom. I'm not sure what the equivalent tool on Mac is, but something like valgrind (Linux and I think Mac?), or Dr Memory (Windows/Linux) would show the original error. Google has an Address Sanitizer tool that does the same stuff.
Basically all these tools do is highjack the memory and tell you exactly where you're overwriting bounds or double deleting or something like that. They detect leaks as well.
You could also try enabling more compiler warnings. Finally, CPPCheck does a good