Fatal Error - Could not allocate memory


This stupid error message keeps showing up when I edit my map and add things to my map. The timing is random and it crashes my Editor every time. My map is very large and I’m almost certain this is what’s causing it but I need my map to be large because its an open world RPG game and I am using multiple servers to host the game along with multiple graphics settings. None of these have been set yet however, the game has 11 zones wide by 14 zones long and each zone is 5000x5000 with a height of 1000. If there is a way around this please help me out! Thanks is advance to any advice givers!

Unity’s a 32-bit application, which means that you’re forced to operate within the limits of a 32-bit memory space. In particular, you can address at most 2^32 bytes of memory, and some operating systems apply specific restrictions beyond that; running a 32-bit app in Windows, for example, your max effective heap size is usually near or under 2GB. The numbers quoted in that error message are pushing that hard – specifically, it looks like your heap is running out of address space.

It’s also possible that rampant heap allocation has led to memory fragmentation. If that’s the problem, a restart or reboot might help.

64-bit editor support may be coming with Unity 5.

Depending on what exactly you’re doing, you might be able to free system resources prior to expensive operations… or, if running your game at all is too taxing, you might be able to optimize the game’s architecture to help.

For example, do you really need everything in one monolithic map? Can you stream content in and out? Is there anything you can do to reduce heap allocation, both in the editor and while the game is running? These are challenges that many open-world games have to address during development.