I’ve started to get memory related crashes with iPhone Unity 1.6 so I’ve implemented the recommended use of a level loader. Essentially I have an empty level that accesses a static global with the next level to load. It works but I’m still getting memory crashes. So I enabled the internal profiler and from what I can see, the heap is reasonably sized so I’m not sure WHY I’m getting the memory warnings and sometimes being killed by the iPhone OS (it seems to happen that the iPhone kills the app almost randomly). It looks like this:
End Load File completely 1.410833 [the empty level]
iPhone Unity internal profiler stats:
cpu-player> min: 2.1 max: 402.3 avg: 27.8
cpu-ogles-drv> min: 0.0 max: 34.4 avg: 3.8
cpu-present> min: 1.2 max: 13.8 avg: 2.8
frametime> min: 30.6 max: 427.3 avg: 60.7
draw-call #> min: 0 max: 53 avg: 8 | batched: 36
tris #> min: 0 max: 27643 avg: 4583 | batched: 3950
verts #> min: 0 max: 30609 avg: 5050 | batched: 4502
player-detail> physx: 2.2 animation: 0.0 culling 0.4 skinning: 0.0 batching: 2.2 render: 5.8 fixed-update-count: 1 … 17
mono-scripts> update: 4.7 fixedUpdate: 0.2 coroutines: 3.0
mono-memory> used heap: 208896 allocated heap: 266240 max number of collections: 0 collection total duration: 0.0
[ two frames of stats deleted but they look pretty much like the one above ]
End Load File completely 12365.687000 [the real level I want]
WARNING → applicationDidReceiveMemoryWarning()
WARNING → applicationDidReceiveMemoryWarning()
WARNING → applicationDidReceiveMemoryWarning()
WARNING → applicationDidReceiveMemoryWarning()
iPhone Unity internal profiler stats:
cpu-player> min: 1.5 max: 21933.3 avg: 752.8
cpu-ogles-drv> min: 0.0 max: 223.9 avg: 11.9
cpu-present> min: 1.3 max: 19.8 avg: 3.9
frametime> min: 27.9 max: 22017.6 avg: 810.3
draw-call #> min: 0 max: 64 avg: 12 | batched: 15
tris #> min: 0 max: 7561 avg: 1489 | batched: 686
verts #> min: 0 max: 10866 avg: 2138 | batched: 1099
player-detail> physx: 15.2 animation: 0.0 culling 1.0 skinning: 0.1 batching: 0.1 render: 10.8 fixed-update-count: 1 … 17
mono-scripts> update: 3.2 fixedUpdate: 8.8 coroutines: 59.5
mono-memory> used heap: 266240 allocated heap: 266240 max number of collections: 0 collection total duration: 0.0
Does anyone have any idea why I would be getting such memory warnings with such a small heap ???