CLR Profiler Allocated Bytes and XNA ContentManager

Posted by Vackup on Game Development See other posts from Game Development or by Vackup
Published on 2012-01-31T19:11:02Z Indexed on 2012/04/15 11:49 UTC
Read the original article Hit count: 187

Filed under:
|
|

I've been fighting with XNA ContentManager and memory allocations for some weeks because I'm trying to port my game from XNA (Windows) to ExEn / Monotouch (iphone).

The problem is that after playing a few levels, my game exits unexpectedly on a real iPhone device (not simulator).

Profiling memory usage on Windows with CLRProfile, I found some useful stuff but I also found something I dont understand. If I use 2 ContentManagers (1 for shared assets and 1 for level assets), when profiling, "Allocated Bytes" grows and grows after level through level but Memory consumption measured by Windows Task Manager stays constant (down when I unload the content manager and up again when I load content). Obviously, I contentManager.Unload() when level ends. After a few levels my game exits unexpectedly on an iPhone device.

If I use 1 content manager, "CRLProfiler Allocated Bytes" stays constant on Windows and on the iPhone; I can play the game normally and it doesnt exit unexpectedly. I use the same assets level through level.

It seems like in ios (iPhone) when loading and unloading the same assets, it allocates memory and consumes all device memory, so the ios kill it.

Can anybody explain me how this really works?
I've read quite a bit, but I still don't understand what's going on.

© Game Development or respective owner

Related posts about XNA

Related posts about ios