I was wondering if you you could have a memory leak on the heap without having any dynamic memory allocated. However, I do have three vectors declared and initialized. Is it because I need to deallocate the vector before I close the program.
Asked
Active
Viewed 392 times
0
-
1You don't need to deallocate the vectors. You should post your code that generated those results. – Trevor Hickey May 04 '16 at 03:09
-
1`vector`'s destructor will deal with the deallocation for you. Can we see some of the code? – DeiDei May 04 '16 at 03:11
-
1Vectors allocate memory dynamically. – user253751 May 04 '16 at 03:12
-
1Copy paste the error instead of attaching the image. That way people can google your problem easily and hopefully help you – Aminah Nuraini May 04 '16 at 03:24
1 Answers
3
I just found the problem, it was the exit function that I was using to close the program.
exit does not call the destructors of any stack based objects so if those objects have allocated any memory internally then yes that memory will be leaked.

Community
- 1
- 1

JimboohDev
- 31
- 2