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

bash - How do you programmatically add a bats test? -

Unable to open serial port using Putty to bluetooth device on windows 7 64 bit -

java - Getting exception in JDBC thin driver -