Advertisement

Memory allocation failing in release mode?

Started by February 23, 2001 04:55 PM
-1 comments, last by Anthracks 23 years, 11 months ago
I'm having a strange problem with memory allocation and the new operator. I was building my game in Debug mode and everything was fine. But when I switched to Release, the game drops me back to the desktop on a specific call to new. It doesn't give me an error or any type of exception, it simply closes down (not calling the shutdown code). The line in question is basically:
    
char **dest;
int count=2;
dest=new char*[count];
    
the line with "new" is exactly what I have in the app, the other two are just how the variables are declared/what value they have so you can see what conditions are. Why the heck would this work in debug but not release mode? I'm trying to allocate an array of char pointers, so I can have in effect something like (pseudocode) sentence[0]="hello" sentence[1]="how" sentence[2]="are" etc. What's going on? For the record, this program is multithreaded, however this code is called well before the second thread is created. (Edit: Also, I use delete[] on the variable a few times (it crashes the first time I use new after delete[]), is this a factor?) Thanks for any help, Anthracks Edited by - Anthracks on February 23, 2001 6:04:33 PM

This topic is closed to new replies.

Advertisement