Memory use

Hey, all,

When viewing your game in the activity monitor in XCode, anyone have any idea of the upper limit that I’ll be cool with on iPhone 3GS hardware?

My game is currently peaking at about 85mb, and given the fact that 3GS hardware has 256mb, I think this should be cool, but I’m getting some “ApplicationDidReceiveMemoryWarning” messages when I’m watching the log information in XCode. The game seems pretty stable, so no real issues there, but I’m having some problems trying to post images to Facebook, which is when the warning appears…

Any ideas?

Cheers,

SB

You will probably always get this Warning when you make a not supersimple scene. Think of that as a trigger or event. When this happens (there are 4 levels of this warning, the higher, the worse) apps should try to free memory.
In xcode for example, in UIViewcontrollers you can override some methodes that deal with those warnings. They will be executed and in there you can free memory if possible. That has nothing to do with unity, however, i think when this warning happens, the garbage collector of unity will try to release unused objects.

But to keep you memory usage low do some of this:

  1. Use Code Stripping to the max (pro only)
  2. Use Power of two Textures, as small as you can, dont waste space inside the texture, use PVRT Textures
  3. if you need best results in textures try to make one “bad but small one” and a “beautiful but big” one. Load those textures by script, depending on which device is running the app on
  4. Avoid hard edges and textureseams on models
  5. make sure your code releases or destroys objects, if you keep references to something it might never get deleted and freed up.
  6. check your app with instruments allocation and leaks and see if memory is rising constantly or gets freed up every now and then.

And so on and so on.