Search the Community
Showing results for tags 'memory'.
-
In my game I store six 2049 x 2049 height-maps in a dynamically created array, like this; size_t mapSize = 2049 * 2049; float* map = new float[mapSize];//approx 16mb When the app closes they are destroyed like this; delete[] map; As far as I can tell, the more data I load in this way, the app will eventually crash with a "bad_alloc" or "memory exception". It doesn't crash when it allocates for the new map I'm loading, it crashes later on when I'm allocating storage for something else. It could be another set of 16mb or the set of 50mb being allocated. Everything will be fine until I add another map. I've tried various things to rule out corrupted files and what not. I've also run the windows "memory diagnostic" just to verify that the ram is working. It should be, I've never had memory issues even with some high RAM demanding games. This is my error catching code too, the memory used is only about 700mb in total. RAM usage is nearly 5gb in the task manager out of 32gb system total. //Class header float* w1_map; float* w2_map; float* w3_map; float* w4_map; float* w5_map; float* w6_map; //class cpp void cFragment::InitMaps() { size_t _mapSize = 2049 * 2049; try { w1_map = new float[mapSize]; w2_map = new float[mapSize]; w3_map = new float[mapSize]; w4_map = new float[mapSize]; w5_map = new float[mapSize]; w6_map = new float[mapSize]; } catch (std::bad_alloc) { long _usedMemory = System::GetMemoryUsage(); std::stringstream _stream; _stream << "Used Memory : " << _usedMemory << "\nFunction : cFragment::InitMaps()\n\nClick OK to Terminate Program."; MessageBox(Window::GetCurrent()->GetHandle(), _stream.str().c_str(), "BAD ALLOC", MB_OK); exit(NULL); } } So I guess my questions are these; Has anyone else had similar issues? Are there limits to how much can be allocated to one pointer? Are there limits to the amount of consecutive calls to "new[]"? I have a 64bit system, but as I understand it L4 and visual studio are 32bit, so the most RAM that can be allocated for the entire application is 4gb?
-
Just got this message ???? Why is that? Is it my ram (i have 16gb)? Is it my gpu memory (I have an nvidia 650 ti boost 2gb superclocked)...