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

R

RV

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é
 
A

Andrew McLaren

Hervé,

You'll probably have better luck by asking in a newsgroup such as
microsoft.public.vc.stl. That group is dedicated to STL questions.

Good luck,

Andrew
 
G

Guest

microsoft.public.dotnet.languages.vc

--
SPAMCOP User


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é
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top