c++ - memory leak from vector -


i'm seeing i'm getting memory leak vector have, i've tried deleting contents clearing vector, erasing vector well. crtdb still informing me of memory leaks, know involves vector because when comment vector related things no leaks. here code doing.

#define _crtdbg_map_alloc #include <stdlib.h> #include <crtdbg.h> #include <vector> #include "myclass.h"  int main(void){     obj *a = new obj();     std::vector<obj> vec;     vec.push_back(*a);      obj b = vec[0];      vec.erase(vec.begin(),vec.end());     delete a;     _crtdumpmemoryleaks();     return 0; } 

your vector hasn't gone out of scope yet when call leak checker.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -