JimmyJammed
JimmyJammed

Reputation: 9698

iOS - Memory usage constantly grows even though no memory leaks shown for actual app (SpriteKit App)

I have a sprite kit game I am building and am nearing completion, so I started profiling the app to make sure I had no memory leaks, etc to improve performance.

I noticed that my memory usage grows about 1mb per second when I run the app : enter image description here

So I started running Instruments, and am not too familiar with using it, but from what I have gathered from tutorials online is that the main thing to pay attention to is the number of persistent allocated objects to ensure that objects you expect to be deallocated are actually deallocated (i.e. enemies you destroyed, bullets that are removed from scene, etc). Instruments does show the expected number of persistent / transient (deallocated) objects throughout the app life cycle but also huge numbers of memory leaks are being reported (~2000 every 10-20 seconds - not sure if from other apps on device or my app):

enter image description here

Here is another image of the Memory Leaks (without filtering my app name - so not sure if its my app that is responsible or not):

enter image description here

If I let the app run for a long period of time, 10+ minutes, it eventually crashes due to:

Message from debugger: Terminated due to memory issue

Any suggestions on how to figure out whats going on? Are the reported ~2000 memory leaks actually from my app? Am I missing something in Instruments?

Upvotes: 2

Views: 1279

Answers (1)

JimmyJammed
JimmyJammed

Reputation: 9698

Ok so it turns out the issue is an Apple Bug when 'showsPhysics' is enabled. Turning this off immediately fixed my problem. Thanks @SklyerLauren.

Upvotes: 4

Related Questions