Thank you!
#include <deque>
#include <crtdbg.h>
struct MyClass { int a, b, c, d; };
int main(){
// Turn on memory leak detection
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_WNDW
| _CrtSetReportMode( _CRT_WARN, _CRTDBG_REPORT_MODE ) );
// Build and fill a deque
std::deque<MyClass> md;
for(int i = 0; i < 128; i++){
MyClass mc = {0,0,0,0};
md.push_back(mc);
}
return 0;
}
>Hello! The following causes a memory leak report in VC 6.0. It seem to
>happen only for this specific object size (16 bytes) and count. Am I doing
>something wrong? Did anybody else run into this?
http://www.dinkumware.com/vc_fixes.html
Apply the <deque> fix (and the others too!)
The memory leak disappears...
Tom
C++ FAQ: http://www.parashift.com/c++-faq-lite/
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
"tom_usenet" <tom_u...@hotmail.com> wrote in message
news:sl1k20pv1m6blafhm...@4ax.com...
>Thank you so much Tom! I tried the fixed <deque> header and the leak goes
>away. It looks like that particular fix has been there, but not in VC,
>since October 1999 (!!!)
It's a long story why it hasn't shipped in any SPs for VC6, but VC7+
has a (probably) bugfree version of <deque>.