My games running fine on my iPhone 3Gs and iPhone 4 with iOS 4.1 - some odd times I do get memory warnings @ Level 1 on the 3Gs
On my iPad with iOS 4.2, my app is using 36MB peak memory … in the game if a player clicks on a specific button they are taken to the app store. By the time the App Store application loads up my game has received a memory warning level 2 and is terminated. This is all with no other apps loaded.
Is anyone else seeing memory issues like this on the iPad running iOS 4.2?
Would love to use stripping but i cannot as I am using some extra DLL’s (System.Data and Mono.Data,Sqlite )and since Unity3 they do not get stripped correctly.
This isn’t an issue/option for me. When i need to call the app store the actual game level still needs to be loaded.
Will look @ that.
I am already using on armv6 only
I tried the trick of shutting down the ipad and restarting it to clear memory and that seems to have helped somewhat although I am still concerned that I get memory warnings when my app is this only one running and the live memory is only 36MB.
restart your ipad
on iOS4+ if the ram gets flooded it goes to the point of laughability where everything just flat out crashes even if you killed all fast app switch apps “running” otherwise (pratically iOS has killed them long ago due to ram shortage but they are still in there)
Yes that seem to help with it crashing every time but I am still concerned that a single unity app with only a 36MB live footprint can receive low memory warnings and get turfed when it is the only User launched app running. I should qualify that it gets turfed after the App Store app is lanched by opening up a iTunes Url from within my game.
I have also tried to run my game under instruments to see what going with memory allocations but it keeps crashing where normally it would run all the way through if not running under instruments.
Does anyone know the corelation betwen Live byes and Overall bytes in the Allocation Instrument?
My assumption is that Live refers to current and Overall refres to current + alocated and released?
When my game first loads to the main menu, the live byte are approx 22MB and over all bytes is @ 80MB, When i run my external function to update my database Live bytes hits aprox 30MB but Overall climbs to about 180 before belly up under instruments. This same operation run successfully if not run under instruments. Hmm and these tools are supposed to help ???
being concerned is fine
but in this case its really just iOS memory leak issues that existed since 1.0 … no matter how much apple hot airs about their “sandbox”, they failed and still fail totally misserably as they have no memory marker mechanism to guarantee that all allocated ram is deallocated on end. the only thing they have are autorelease pools and they just don’t give a damn about objects allocated by anything but objc which means reasonably seen “most things from games and more intense things that are not just some ui stuff”
What really has me concerend is that once I update my iPhone 3Gs and my iPhone4 to 4.2.1… if they start to exhibt the same behaviour then I could really get upset
Similar type problem with my ipod. I am having an issue, where it crashes my app when trying to load a scene, this happens consistently on my IPOD touch 2G, the problem seemed to be that it was reaching some upper limit (for example when I changed back my lightmaps back from truecolor to compressed it stopped happening).
Got a similar crash problem. Overall bytes counting up on load of GUI or game level, and crash, with memory warning level 1 and 2 before. But only on iPad1, not iPad2, and only if plenty of apps are sleeping in the background. (Check by double click home button). Since a “normal” user would never remove apps from that sleep-state, this kind of crash might happen to plenty of people with iPad1. I already got 1-star reviews because of this. Something does not seem logical here, and I suspect a bug in the compiling from Unity3D to Xcode, or an iOS bug. I’m already seriously considering developing for iPad2 only, and excluding iPad1, which would require the use of the gyroscope or any iPad1-only feature, so Apple would approve the app for iPad2 only.
You could try unloading unused objects before calling the appstore however you need to be aware that just because it runs for a while on an iPad2 doesnt mean it will run forever, you may run into crashes on the iPad2 but they will take longer because its got more performance than the 1.
there is a nice memory bleed test script somewhere in the forum, sadly i forgot where it is. if you can put that on your game it can help greatly analyzing whats growing where.
so here is my version of the detect leaks script with a button for cleaning up dead stuff:
using UnityEngine;
using System.Collections;
public class DetectLeaks : MonoBehaviour {
void OnEnable()
{
//used attached to a camera in scene to delete unused objects.
StartCoroutine(UnloadDeadStuff());
}
void OnGUI () {
//displays a list of all objects that are loaded
GUILayout.Label("All " + Resources.FindObjectsOfTypeAll(typeof(UnityEngine.Object)).Length);
GUILayout.Label("Textures " + Resources.FindObjectsOfTypeAll(typeof(Texture)).Length);
GUILayout.Label("AudioClips " + Resources.FindObjectsOfTypeAll(typeof(AudioClip)).Length);
GUILayout.Label("Meshes " + Resources.FindObjectsOfTypeAll(typeof(Mesh)).Length);
GUILayout.Label("Materials " + Resources.FindObjectsOfTypeAll(typeof(Material)).Length);
GUILayout.Label("GameObjects " + Resources.FindObjectsOfTypeAll(typeof(GameObject)).Length);
GUILayout.Label("Components " + Resources.FindObjectsOfTypeAll(typeof(Component)).Length);
ShowDeadStuffButton();
}
IEnumerator UnloadDeadStuff(){
//see what we have now then wait 5 secs remove unused assets and look again.
Debug.Log(“Startunloading Count” + Resources.FindObjectsOfTypeAll(typeof(UnityEngine.Object)).Length);
Debug.Log("Textures " + Resources.FindObjectsOfTypeAll(typeof(Texture)).Length);
Debug.Log("AudioClips " + Resources.FindObjectsOfTypeAll(typeof(AudioClip)).Length);
Debug.Log("Meshes " + Resources.FindObjectsOfTypeAll(typeof(Mesh)).Length);
Debug.Log("Materials " + Resources.FindObjectsOfTypeAll(typeof(Material)).Length);
Debug.Log("GameObjects " + Resources.FindObjectsOfTypeAll(typeof(GameObject)).Length);
Debug.Log("Components " + Resources.FindObjectsOfTypeAll(typeof(Component)).Length);
//wait so we can see whats being used
yield return new WaitForSeconds(5);
//removes any unused assets
Resources.UnloadUnusedAssets();
Debug.Log(“stopunloading Count” + Resources.FindObjectsOfTypeAll(typeof(UnityEngine.Object)).Length);
Debug.Log("Textures " + Resources.FindObjectsOfTypeAll(typeof(Texture)).Length);
Debug.Log("AudioClips " + Resources.FindObjectsOfTypeAll(typeof(AudioClip)).Length);
Debug.Log("Meshes " + Resources.FindObjectsOfTypeAll(typeof(Mesh)).Length);
Debug.Log("Materials " + Resources.FindObjectsOfTypeAll(typeof(Material)).Length);
Debug.Log("GameObjects " + Resources.FindObjectsOfTypeAll(typeof(GameObject)).Length);
Debug.Log("Components " + Resources.FindObjectsOfTypeAll(typeof(Component)).Length);
}
Check your total used memory with activity monitor instead of allocations. You may be using more memory than you think - I can verify that my most recent released title uses over 50mb on iPad and doesn’t typically get any memory warnings.