I have a VS 2005 C++ project with both Debug and Release builds. I've attempted the following 4 things:
- Build a Debug executable through Visual Studio, and run it through Visual Studio.
- Run the executable built in (1) externally via command line (Cygwin) after
cd
'ing tovstudio/debug
. - Build a Release executable through Visual Studio, and run it through Visual Studio.
- Run the executable built in (3) externally via command line (Cygwin) after
cd
'ing tovstudio/release
.
The first 3 all succeed: the program runs to completion.
The fourth, however, crashes at runtime. Debugging shows that the culprit is the call to malloc()
inside the operator new()
. The relevant context looks something like this:
template<typename T> class Foo {
...
static void bar() {
...
T* ptr = new T();
...
}
...
}
If anyone can think of any problem which would lead to the 3-out-of-4 symptoms I describe, it would be much appreciated.