Will Unity deallocate any memory when it gets a memory warning?

So I find that a default xcode project template when run on the device takes up 5 mb of ram.

Then an empty unity scene, when compiled and run takes up 10 mb.

Which means unity takes up an additional 5 mb of ram over and above what is required by an empty xcode project.

What I am curious to know is, if unity receives a memory warning, will it deallocate any of this 5 mb of ram if unity is in the background?

I know Unity does not deallocate any of the textures or game content… and for obvious reasons. That needs to be handled by the user.

But does the components of unity, which are not controllable by the user, do those handle memory deallocation themselves if they recieve a memory warning in the background?

No.

What you should do is ensure your app never gets past 100 megs. That’s pretty high for ios.

Unity itself will do nothing and springboard will terminate your app at any random point after around 120 meg. So best limit to 100 or so.

If you’re worried about 10mb, you’re wasting a lot time. Just focus on your game and ensure you don’t breach 100 meg.

If you want to play nicely with iOS, then you can just deallocate whenever you get memory warnings and you’re not running the app.

you can do it yourself.

Go to the XCode Project - AppController and add a UnitySendMessage to the function call and call a specific GO and function inside your game.

In that function, deallocate everything you cached / pooled you don’t need and then call the unload unused assets function

especially kill every ‘decompress on load’ audio clip no longer required for granted

I have 128 decompress on load audio clips in ram at one time. Just a small bit of trivia. The memory requirements are horrific :)))))

hehe yeah such audio is heavy … up to 10mb per minute of audio basically, which is massive at 100-120MB RAM + VRAM at maximum on 3GS+ (without taking iphone4, ipad2, iphone4s into consideration which have another 256mb ram at hand)