My program is crashing at runetime. It says "Program.exe" has stopped working blah blah blah.
I finally traced the problem code down to this:
struct RandomTile
{
unsigned short int tilegraphic;
unsigned short int objectgraphic;
unsigned char type; // type of tile, barrier etc
unsigned short int door; // index to door table
unsigned short int text; // index to text table
unsigned short int treasure; // index to treasure table
};
class RandomMap
{
public:
private:RandomTiletiles[500][500];
};
When I decrease the size of the tile array to 300 x 500 the program runs fine. But anything over 400 will crash it.
I am on a system with 766 megs of ram free. Running windows vista.
I did a sizeof on my engine class ( which allocates 1 instance of RandomMap ) and it says about 2 megs.
The only thing I can think of is some kind of bug with the devcpp compiler.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I had this before. For some reason there is a maximum allowed object size for the arrays you create. I was making a 3D square array and above a certain size the code would crash whereas below the critical size it would run without any problems. I've read somewhere that the maximum size is something to do with certain system parameters, but it seems totally lame to me that there is a limit on the arrays you can make that isn't simply the amount of physical memory.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"Have you checked that you have not exceeded the bounds of the array in some forloop or other,
To say its a bug with devcpp's compiler is laughable."
The array is completely unused it is just declared inside class RandomMap and then an instance of RandomMap is declared.
RandomMap is also unused.
I suppose its my fault somewhere but I just cannot figure out where.
I actually recompiled the code in VC++ express 2008 and still got the same problem. I just cannot figure out what could be wrong so I rewrote my engine class as a set of functions and it worked fine. Oh well who knows.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My program is crashing at runetime. It says "Program.exe" has stopped working blah blah blah.
I finally traced the problem code down to this:
struct RandomTile
{
unsigned short int tilegraphic;
unsigned short int objectgraphic;
unsigned char type; // type of tile, barrier etc
unsigned short int door; // index to door table
unsigned short int text; // index to text table
unsigned short int treasure; // index to treasure table
};
class RandomMap
{
public:
};
When I decrease the size of the tile array to 300 x 500 the program runs fine. But anything over 400 will crash it.
I am on a system with 766 megs of ram free. Running windows vista.
I did a sizeof on my engine class ( which allocates 1 instance of RandomMap ) and it says about 2 megs.
The only thing I can think of is some kind of bug with the devcpp compiler.
I had this before. For some reason there is a maximum allowed object size for the arrays you create. I was making a 3D square array and above a certain size the code would crash whereas below the critical size it would run without any problems. I've read somewhere that the maximum size is something to do with certain system parameters, but it seems totally lame to me that there is a limit on the arrays you can make that isn't simply the amount of physical memory.
Have you checked that you have not exceeded the bounds of the array in some forloop or other,
To say its a bug with devcpp's compiler is laughable.
"Have you checked that you have not exceeded the bounds of the array in some forloop or other,
To say its a bug with devcpp's compiler is laughable."
The array is completely unused it is just declared inside class RandomMap and then an instance of RandomMap is declared.
RandomMap is also unused.
I suppose its my fault somewhere but I just cannot figure out where.
I actually recompiled the code in VC++ express 2008 and still got the same problem. I just cannot figure out what could be wrong so I rewrote my engine class as a set of functions and it worked fine. Oh well who knows.