STL leaks ?
-
Does anybody have any idea why this program leaks ? It's a problem with STL or what ? I'm using VC++ 6.0, SP 5, W2K #include #include using namespace std; void test() { fstream fs("dbg.txt", ios::out); fs.close(); } void main(void) { test(); _CrtDumpMemoryLeaks(); }
-
Does anybody have any idea why this program leaks ? It's a problem with STL or what ? I'm using VC++ 6.0, SP 5, W2K #include #include using namespace std; void test() { fstream fs("dbg.txt", ios::out); fs.close(); } void main(void) { test(); _CrtDumpMemoryLeaks(); }
It doesn't leak. The problem (if you can call it that) is that _CrtDumpMemoryLeaks is being called before global object destruction, thus it thinks there is a leak when the object is really destroyed afterwards. -- Where are we going? And why am I in this handbasket?
-
It doesn't leak. The problem (if you can call it that) is that _CrtDumpMemoryLeaks is being called before global object destruction, thus it thinks there is a leak when the object is really destroyed afterwards. -- Where are we going? And why am I in this handbasket?
So STL has global objects ? (besides cin,cout and cerr ). Because I don't have any global objects ( that's my concern - the fstream object is created on the stack , so it's destroyed before I call _CrtDumpMemoryLeaks) . If it has, do you have any idea, are these objects thread safe ? And can you name some ?