Could not allocate memory: System out of memory! (Windows Phone)

Hi, I’m trying to build my game in Windows Phone, with a unity 4.3.1, and when I play for a moment, the game going to crash and shows me this.

Could not allocate memory: System out of memory!
Trying to allocate: 2596864B with 4 alignment. MemoryLabel: NewDelete
Allocation happend at: Line:0 in Overloaded New
Memory overview

[ ALLOC_DEFAULT ] used: 18815422B | peak: 22811587B | reserved: 22615114B

[ ALLOC_GAMEOBJECT ] used: 1116492B | peak: 2862269B | reserved: 1313280B

[ ALLOC_GFX ] used: 12627596B | peak: 32614107B | reserved: 12629873B

[ ALLOC_PROFILER ] used: 63184B | peak: 179352B | reserved: 202058B

Could not allocate memory: System out of memory!
Trying to allocate: 2596864B with 4 alignment. MemoryLabel: NewDelete
Allocation happend at: Line:0 in Overloaded New
Memory overview

[ ALLOC_DEFAULT ] used: 18815422B | peak: 22811587B | reserved: 22615114B

[ ALLOC_GAMEOBJECT ] used: 1116492B | peak: 2862269B | reserved: 1313280B

[ ALLOC_GFX ] used: 12627596B | peak: 32614107B | reserved: 12629873B

[ ALLOC_PROFILER ] used: 63184B | peak: 179352B | reserved: 202058B

(Filename: C:/BuildAgent/work/d3d49558e4d408f4/Runtime/Allocator/MemoryManager.cpp Line: 793)

The program ‘[1472] TaskHost.exe’ has exited with code -2147483645 (0x80000003).

I don’t understand why the windows phone crashing always if I try to run the game in a nokia lumia 520, and his technical specifications are same to the iphone 4, and my game runs correctly in the iphone 4.

please what’s wrong ?

1 Answer

1

Well, it seems like your application is requesting more memory than is available and crashes violently.

While both the iPhone4 and Lumia 520 have 512MB RAM, Windows Phone limits a single application’s memory consumption to 150~180 MB on lower end devices, from the log you’re trying to allocate 317MB.

The only real solution here is to downsize your memory footprint significantly. Try compressing/downscaling all textures and streaming audio.

For more information on memory limits on Windows Phone OS, check this out:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj681682(v=vs.105).aspx

Do note there’s a specific manifest flag for requesting extended memory allocation, but that is only available on devices with more than 1GB RAM.

How do you know it's 317MB?

where does 317MB comes from? Doesn't total reserved memory no more than 70MB?