iPad real memory accumulation, how to prevent this?


Currently running my app under Performance tools Activity checks and looking at the Real Memory entry.

It keeps accumulating as I load levels, Levels have more or less the same amount of textures and code, so why does the real memory accumulates. I don't load additive, I simply load a new level (Application.LoadLevel). The amount of gameObject not destroyed within the entire application is constant.

It seems that when a memory warning is issued, it cleans a bit , but it's never back to the start up value or anywhere close.

Am I missing something really obvious?

I though that Application.LoadLevel() was the best way to manage memory consumptions.

Thanks for your insight,




I found that loadLevel do not release assets properly for the garbage collector to to its work when needed, and in the troubleshooting page, they mentionned loadLevelAdditive as an alternative and it works reliably.

1- load an empty scene using loadLevel() ( a special scene with nothing in it) 2- load your actual scene additively using LoadLevelAdditive() 3- I just call UnloadUnusedAssets just to force things. it might not be required tho.

in effect, this equal loadLevel(), but now, the app is 100% stable and I don't get any memory warnings like when just using loadLevel() only.

Hope it helps,