Memory Limit of Swift Playgrounds

Hi everyone!

I am working on a playground which uses SceneKit. For this, I am adding 54 individual spheres to the scene. On my mac everything works fine but when I use the project on my iPad it crashes. I suspect my playground runs out of memory on the iPad.


Do you know the memory limits of Swift Playgrounds on iPad?


Yours,

Max

Accepted Reply

HI everyone!

I’ve solved it! As I’ve said I was creating a lot of spheres in a for loop. The solution for me was to wrap the creation of these in a autoreleasepool:

for object in self.town!.objects.values {
    autoreleasepool {
       townNode.addChildNode(object.nodeForObject())
    }
}


I also found that the performance in Xcode and the iOS Simulator are not representative of real world device performance. While it was hard to sustain a framerate of around 12 FPS on my Macbook Pro I could easily hit 60 FPS on an iPad Air 2. Also, turning off logging in the Swift Playground Book gave me a heavy performance boost.

Replies

I don't think there is a simple/hard number/limit, but it's easy to imagine your mac having more memory than your iPad.


Can you better describe 'crashes'? Is there an error, or perhaps iOS is just killing it off, or...?


Do you know how to use Xcode to test memory use while debugging on a connected iPad?


How many spheres do you have to remove to cure the issue?

HI everyone!

I’ve solved it! As I’ve said I was creating a lot of spheres in a for loop. The solution for me was to wrap the creation of these in a autoreleasepool:

for object in self.town!.objects.values {
    autoreleasepool {
       townNode.addChildNode(object.nodeForObject())
    }
}


I also found that the performance in Xcode and the iOS Simulator are not representative of real world device performance. While it was hard to sustain a framerate of around 12 FPS on my Macbook Pro I could easily hit 60 FPS on an iPad Air 2. Also, turning off logging in the Swift Playground Book gave me a heavy performance boost.