473,394 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Dinkumware STL, MFC and memory leak

Hi Guys,

I've been try to use Dinkum STL library.

It workes well first, but report memory leak in MFC Debug Mode.

I use Dinkum Unabridged Library for VC++ V4.02, MSVC6, WIN2000 SERVER.

I made a dialog based program by MSVC6, inserted simple code to use
Dinkum STL Library, and added simple code like this.

// TODO: Add extra initialization here
std::list<int> *mylist = new std::list<int>;
mylist->push_back(1);
mylist->push_back(2);
mylist->clear();
delete mylist;
And I got memory leak message like this.

Detected memory leaks!
Dumping objects ->
{70} normal block at 0x003447F0, 200 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00
Object dump complete.
The thread 0x10F4 has exited with code 0 (0x0).
The program 'D:\zzzzzzzzzzzzz\Debug\zzzzzzzzzzzzz.exe' has exited with
code 0 (0x0).

I tested more complicate program, and got more leaks message.

Is a bug of Dinkum STL or MSVC6 or misuse?
blugus.
Jul 22 '05 #1
5 4845
bl********@hotmail.com (blugus) wrote in
news:d9**************************@posting.google.c om:
Hi Guys,

I've been try to use Dinkum STL library.

It workes well first, but report memory leak in MFC Debug Mode.

I use Dinkum Unabridged Library for VC++ V4.02, MSVC6, WIN2000 SERVER.

I made a dialog based program by MSVC6, inserted simple code to use
Dinkum STL Library, and added simple code like this.

// TODO: Add extra initialization here
std::list<int> *mylist = new std::list<int>;
mylist->push_back(1);
mylist->push_back(2);
mylist->clear();
delete mylist;
And I got memory leak message like this.

Detected memory leaks!
Dumping objects ->
{70} normal block at 0x003447F0, 200 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00
Object dump complete.
The thread 0x10F4 has exited with code 0 (0x0).
The program 'D:\zzzzzzzzzzzzz\Debug\zzzzzzzzzzzzz.exe' has exited with
code 0 (0x0).

I tested more complicate program, and got more leaks message.

Is a bug of Dinkum STL or MSVC6 or misuse?


There is insufficient (OK, rather too much) information to determine.
(Welcome to comp.lang.c++, we don't care about MFC or Dialogs. Neither
are Standard C++). First, you are concerned with STL. OK, limit it to
only the STL portion. Try:

#include <list>

int main() {
std::list<int> * mylist = new std::list<int>;
mylist->push_back(1);
mylist->push_back(2);
mylist->clear();
delete mylist;
return 0;
}
And see if that leaks. If you only have that code and it still leaks,
then you may have an issue with your STL library.
Jul 22 '05 #2
"blugus" <bl********@hotmail.com> wrote in message
news:d9**************************@posting.google.c om...
I've been try to use Dinkum STL library.

It workes well first, but report memory leak in MFC Debug Mode.

I use Dinkum Unabridged Library for VC++ V4.02, MSVC6, WIN2000 SERVER.

I made a dialog based program by MSVC6, inserted simple code to use
Dinkum STL Library, and added simple code like this.

// TODO: Add extra initialization here
std::list<int> *mylist = new std::list<int>;
mylist->push_back(1);
mylist->push_back(2);
mylist->clear();
delete mylist;
And I got memory leak message like this.

Detected memory leaks!
Dumping objects ->
{70} normal block at 0x003447F0, 200 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00
Object dump complete.
The thread 0x10F4 has exited with code 0 (0x0).
The program 'D:\zzzzzzzzzzzzz\Debug\zzzzzzzzzzzzz.exe' has exited with
code 0 (0x0).

I tested more complicate program, and got more leaks message.

Is a bug of Dinkum STL or MSVC6 or misuse?


We know of no leaks, but more than one leak detector reports
false positives. The usual cause is the delayed release of
memory for certain lazy evaluations. The release occurs *after*
the leak detector makes its report.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
Jul 22 '05 #3

"blugus" <bl********@hotmail.com> wrote in message
news:d9**************************@posting.google.c om...
Hi Guys,

I've been try to use Dinkum STL library.

It workes well first, but report memory leak in MFC Debug Mode.

I use Dinkum Unabridged Library for VC++ V4.02, MSVC6, WIN2000 SERVER.

I made a dialog based program by MSVC6, inserted simple code to use
Dinkum STL Library, and added simple code like this. <SNIP> I tested more complicate program, and got more leaks message.

Is a bug of Dinkum STL or MSVC6 or misuse?
blugus.


Its worth remembering that some libraries overload the new operator... This
could be causing some problems, so it might be worth checking through your
header files. If there is some overloaded operator causing the problem, try
to change the order of the includes to correct the problem.
HTH,
S. Armondi
Jul 22 '05 #4
Hi there,

as you already know the allocation order number (70), why don't you
just set a breakpoint there (_CrtSetBreakAlloc())?

You might also want to consider applying a professional tool for
memory leak and corruption detection, like Compuware's BoundsChecker
(this one also finds out about destroyed stackframes, missing thread
synchronization, and more).

Kind regards,
Arno Huetter

bl********@hotmail.com (blugus) wrote in message news:<d9**************************@posting.google. com>...
Hi Guys,

I've been try to use Dinkum STL library.

It workes well first, but report memory leak in MFC Debug Mode.

I use Dinkum Unabridged Library for VC++ V4.02, MSVC6, WIN2000 SERVER.

I made a dialog based program by MSVC6, inserted simple code to use
Dinkum STL Library, and added simple code like this.

// TODO: Add extra initialization here
std::list<int> *mylist = new std::list<int>;
mylist->push_back(1);
mylist->push_back(2);
mylist->clear();
delete mylist;
And I got memory leak message like this.

Detected memory leaks!
Dumping objects ->
{70} normal block at 0x003447F0, 200 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00
Object dump complete.
The thread 0x10F4 has exited with code 0 (0x0).
The program 'D:\zzzzzzzzzzzzz\Debug\zzzzzzzzzzzzz.exe' has exited with
code 0 (0x0).

I tested more complicate program, and got more leaks message.

Is a bug of Dinkum STL or MSVC6 or misuse?
blugus.

Jul 22 '05 #5
First of all, Sorry for misuse board.

I tried to post the message in comp.lang.c++.moderated, but I made a
mistake.
I try to set a breapoint by _CrtSetBreakAlloc().

But breakpoint doesn't work, if memory leaks were generated by Dinkum
LIB.

Of course, other breakpoints work if memory leaks were generated by my
own code.

I don't know why breakpoints doesn't work if it related with Dinkum
LIB.


I make a new simple dialog based program, not use Dinkum LIB.
And I try to set more breakpoint like this.

_CrtSetBreakAlloc(1){,,msvcrtd.dll}
_CrtSetBreakAlloc(2){,,msvcrtd.dll}
_CrtSetBreakAlloc(3){,,msvcrtd.dll}
_CrtSetBreakAlloc(4){,,msvcrtd.dll}
...................................
_CrtSetBreakAlloc(68){,,msvcrtd.dll}
but 1~48 breakpoints does not works.

Because the global variable _crtBreakAlloc does not set before
_lRequestCurr become 49 in DBGHEAP.C file.

The code is like this.
-----------------------------------------------------------
void * __cdecl _heap_alloc_dbg(
size_t nSize,
int nBlockUse,
const char * szFileName,
int nLine
)
{
long lRequest;
size_t blockSize;
int fIgnore = FALSE;
_CrtMemBlockHeader * pHead;

/* verify heap before allocation */
if (_crtDbgFlag & _CRTDBG_CHECK_ALWAYS_DF)
_ASSERTE(_CrtCheckMemory());

lRequest = _lRequestCurr;

/* break into debugger at specific memory allocation */
if (lRequest == _crtBreakAlloc)
_CrtDbgBreak(); // <----- breakpoint ..
-----------------------------------------------------------

If I use Dinkum LIB, the memroy leak occur in DEBUG mode.
And the code line number, which make memory leak, is not displayed in
Output Window.

If the line number is not displayed, the _CrtSetBreakAlloc() function
doesn't work.

I think that Dinkum LIB code tries to allocate memory before debug
code is initialized.
So the code number, which generate memory leak, doesn't displayed.
And the breakpoint, which relate with it, doesn't work.

Maybe the problem is about environments.

I use a Korean OS, Korean MSVC6.

I don't try to test Dinkum LIB in English OS.

After the environment test, I will post about it.
Jul 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Elbert Lev | last post by:
#When I'm running this script on my windows NT4.0 box, #every time dialog box is reopened there is memory growth 384K. #Bellow is the text I sent to Stephen Ferg (author of easygui) # I have...
32
by: John | last post by:
Hi all: When I run my code, I find that the memory that the code uses keeps increasing. I have a PC with 2G RAM running Debian linux. The code consumes 1.5G memory by the time it finishes...
7
by: mosaic | last post by:
Hi, all I really interested in how to check the memory leak of a program. Your smart guys, do you have excellent ideas that could share with me? Thank you. The following is my idea: In C...
8
by: ranjeet.gupta | last post by:
Dear All Is the Root Cause of the Memory corruption is the Memory leak, ?? suppose If in the code there is Memory leak, Do this may lead to the Memory Corruption while executing the program ? ...
17
by: José Joye | last post by:
Hi, I have implemented a Service that is responsible for getting messages from a MS MQ located on a remote machine. I'm getting memory leak from time to time (???). In some situation, it is...
4
by: Don Nell | last post by:
Hello Why is there a memory leak when this code is executed. for(;;) { ManagementScope scope = new ManagementScope(); scope.Options.Username="username"; scope.Options.Password="password";...
23
by: James | last post by:
The following code will create memory leaks!!! using System; using System.Diagnostics; using System.Data; using System.Data.SqlClient; namespace MemoryLeak
16
by: KS | last post by:
Hello, I have a memory leak in my application and I have identified two lines of code that cause the leak. If I comment out these lines, the program runs fine. If left uncommented, the memory...
7
by: Ragnar Agustsson | last post by:
Hi all I have been wandering about the best way to sandbox memory leaks in 3rd party libraries when using them from the .Net framework. I have a 3rd party library, written in C++, that leaks a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.