Memory Leak with no dynamic memory

て烟熏妆下的殇ゞ 提交于 2020-01-07 00:08:18

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/37017667/memory-leak-with-no-dynamic-memory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!