Original Post
I guess I don''t understand memory allocation in C++ as well as I though I did. Here is my problem. I am implementing a tile-based game in DirectX. I have a global map variable consisting of an array of node classes:
Cnode *map;
In my initialization I allocate memory like this:
...
Allocate Surfaces for bitmaps
...
map=new Cnode[mapx*mapy];
This was working until I started trying to allocate more surfaces for bitmaps. My program would no longer get past initialization unless I decreased the size of my map. This seemed strange to me since the game has nothing in it right now and the Cnode class consists of 1 variable and a constructor at this point. Also my computer has 256mb of ram so I know I haven''t used it up. Anyway, if I instead declare the map like this:
Cnode map[SOME_CONSTANT]
I have no problems. I should know this, but why is it giving me trouble when I try and allocate it dynamically during my initialization, but if I declare it with a constant globally everything is fine?
Abs