Reputation: 31
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.
Upvotes: 0
Views: 558
Reputation: 31
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.
https://stackoverflow.com/a/7414211/6284032
Upvotes: 3