473,856 Members | 1,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:\zzzzzzzzzzz zz\Debug\zzzzzz zzzzzzz.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 4869
bl********@hotm ail.com (blugus) wrote in
news:d9******** *************** ***@posting.goo gle.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:\zzzzzzzzzzz zz\Debug\zzzzzz zzzzzzz.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********@hot mail.com> wrote in message
news:d9******** *************** ***@posting.goo gle.com...
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:\zzzzzzzzzzz zz\Debug\zzzzzz zzzzzzz.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********@hot mail.com> wrote in message
news:d9******** *************** ***@posting.goo gle.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. <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 (_CrtSetBreakAl loc())?

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********@hotm ail.com (blugus) wrote in message news:<d9******* *************** ****@posting.go ogle.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:\zzzzzzzzzzz zz\Debug\zzzzzz zzzzzzz.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++.m oderated, but I made a
mistake.
I try to set a breapoint by _CrtSetBreakAll oc().

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.

_CrtSetBreakAll oc(1){,,msvcrtd .dll}
_CrtSetBreakAll oc(2){,,msvcrtd .dll}
_CrtSetBreakAll oc(3){,,msvcrtd .dll}
_CrtSetBreakAll oc(4){,,msvcrtd .dll}
............... ............... .....
_CrtSetBreakAll oc(68){,,msvcrt d.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;
_CrtMemBlockHea der * pHead;

/* verify heap before allocation */
if (_crtDbgFlag & _CRTDBG_CHECK_A LWAYS_DF)
_ASSERTE(_CrtCh eckMemory());

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 _CrtSetBreakAll oc() 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
3651
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 tested the pure Tkinter, # by modifiing on of the examples in the distribution. # This little guy also exibits the same behaviour. # Namely: every time the window is closed and reoppend, # there is memory leak of several hundreds 384K
32
3877
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 execution. But I do not think it needs so much memory. About 500M memory should be enough. I have following questions about memory leak. (1).If in my code I only define constructor for my class, and do not define destructor, will it cause memory leak?
7
2661
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 programming language, there's a "malloc", there must a "free", my solution of the detection of leak is, find the corresponding "free" of "malloc". This the first condition.
8
3423
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 ? In nut shell, what is/are the realtion/s between the Memory Leak and Memory Corruption. Juts Theoritical Assumtion below:
17
4828
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 easier to reproduce (e.g.: remote machine not available). After about 1 day, I get a usage of 300MB of memory. I have used .NET Memory Profiler tool to try to see where the leak is located. For all the leaky instances, I can see the following (I...
4
6099
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"; scope.Path.Path=@"\\pc\root\cimv2";
23
4583
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
510
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 usages keeps increasing till the program terminates due to lack of available memory. I have marked the two lines that cause this problem in the code in the function main() (at the bottom of the file).
7
15722
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 lot of memory but I still had to use it. 1. After using DLLImport and seeing the memory leak I tried to load and
0
9762
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11057
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10696
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10782
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7932
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7094
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5761
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5958
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4174
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.