Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Memory leak in deque - is this a bug, a known issue, or am I doing something wrong?

0 views
Skip to first unread message

Boris Glick

unread,
Feb 10, 2004, 9:47:44 PM2/10/04
to
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?

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;
}


tom_usenet

unread,
Feb 11, 2004, 5:45:57 AM2/11/04
to
On Wed, 11 Feb 2004 02:47:44 GMT, "Boris Glick"
<boris...@sbcglobal.net> wrote:

>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

Boris Glick

unread,
Feb 11, 2004, 11:14:03 AM2/11/04
to
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 (!!!)

"tom_usenet" <tom_u...@hotmail.com> wrote in message
news:sl1k20pv1m6blafhm...@4ax.com...

tom_usenet

unread,
Feb 11, 2004, 12:47:13 PM2/11/04
to
On Wed, 11 Feb 2004 16:14:03 GMT, "Boris Glick"
<boris...@sbcglobal.net> wrote:

>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>.

0 new messages