VC++ 2005 and STL std::bad_alloc in xtree

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hello world,

I have a crash with my program in release mode only. I develop with VC+
+ 2005 Express Edition, I started my project with an empty win32
project and use the submodule:Window. My program is successfully
compiled in both mode debug and release but it is at the execution
that the crash comes. It when I replace DLL Multithread (/MTd) for
debug by DLL Multithread (/MT) for release mode.
My problem is quite simple :

class MyClass{
MyClass()
{
Do something or not....
}
map<string,int> myMap;
}

This simple class makes my program crash at the execution in release
mode. I have a message std::bad_alloc at 0x...... I modified release
mode options to generate debuging informations and to have the
possibility to use breakpoints. With breakpoints, I have seen that the
problem appears at the creation of the instance. I don't reach the
constructor code. The exception comes in the <xtree> file from the STL
librairie. But when I delete the line of the static allocation of
myMap :

class MyClass{
MyClass()
{
Do something or not....
}
//map<string,int> myMap;
}

The program doesn't crash and works as well as I don't use map or
sstream this kind of STL tools. It is so the static allocation of the
map that makes my program crash
My Visual C++ project is without MFC and without ATL. It is only a
Win32 project with /SUBSYSTEM:WINDOWS options to create a simple form,
I don't really need graphics but I need a hwnd to use a message loop.

Is this a known bug with STL and VC++ 2005 win32 project.
I saw this (url]http://msdn.microsoft.com/en-us/magazine/cc164087.aspx
[/url]
Is this problem in relation with my problem ???
Thanks
Hervé
.



Relevant Pages

  • Re: VC++ 2005 and STL std::bad_alloc in xtree
    ... I have a crash with my program in release mode only. ... class MyClass{ ... The exception comes in the file from the STL ... Is this a known bug with STL and VC++ 2005 win32 project. ...
    (microsoft.public.windowsxp.general)
  • Re: Windows Service Crashing
    ... I ask because the first thing that comes to my mind ... is that a call to Win32 with improper arguments is ... more likely to cause a crash in your service. ...
    (microsoft.public.dotnet.general)
  • Re: RAD Studio 2007 A Pleasure
    ... Sad to hear that about ASP.Net projects, tho I use IW in Win32. ... I have had one crash in the last 4 months using Delphi 2007, but I only use the Win32 portion, and I have about 15 major third-party component libraries installed. ...
    (borland.public.delphi.non-technical)
  • Re: newbee: trouble w/ try{} catch{}
    ... What am I missing? ... The best is to write a minidump when the crash occurs, ... My blog about Win32 and .NET ...
    (microsoft.public.vc.language)
  • CodeGuard-like tool for VC8?
    ... non-managed application compiled with VC8. ... If I load and run the application in the IDEit just doesn't crash (and I ... STL to catch this (and a step-by-step exection reveals that the STL is being ... When I used to work with the Borland compiler, I used a tool called Code ...
    (microsoft.public.vc.debugger)