I'm having a hard time understanding how to tell between dangling pointers and memory leaks. I have a few questions on a recent assignment that are puzzling me, and after reading into it, I am still puzzled. I don't want someone to do my homework for me, I want to...
I'm new to the language and I have a basic doubt about memory leaks. Is it possible to have a leak if I don't use the new keyword? (i.e having my variables in the stack and using data containers like std::vector)
I am creating a c++ object with two slightly different ways, in the following code when CASE is 0 there is a memory leak, but no memory leak in the else case.
I used to believe it does for certain but... I can't find it explicitly stated.man 3 exit and man 2 _exit verbosely specify the effects of process termination, but don't mention memory leaks.
A couple of months ago I asked this question where I asked why there was a memory leak. Apparently, I forgot a virtual destructor.
I have this code:When program starts memory consumption is about ~600kb, and when it ends ~1700kb. Is it memory leak or what?
I'm using valgrind to check for memory leaks. Unfortunately I get a Leak_DefinitelyLost warning.Attached is a simplified version of my code that reproduces the error:
The following codeCompiled and run width clang in macOS:Got resultCompiled and run in Visual Studio 2015 Update 3: