2

I'm making a game in Swift using SpriteKit that has a background (landscape) and some objects on it. All of these are created as SKSpriteNodes and are added using addChild.

I also add cropping nodes (again using addChild) to be used for some purposes.

In total there are 23 nodes being loaded. In the profiler, it says my memory usage is 238MB.

I wanted to ask if this is a lot (I suspect it is) and then ask what I can do to reduce this and what I should be looking at?

My SKSpriteNodes are all about 375-400kb (per each node at 3x) and a resolution @3x of about 300-600 x 300-600 range (width/height ranges depending upon the object).

Am I doing something wrong here? Are these images too big? Are they not optimized enough?

Thanks so much in advance for any insight/pushes in the right direction.

NullHypothesis
  • 4,286
  • 6
  • 37
  • 79
  • 1
    When you say SKSpriteNode size, you mean texture size, right? If so, note that texture size on disk is not the same as texture size in memory : http://stackoverflow.com/a/29112351/3402095. Also, use real device for tests (dont' take Simulator into account) and check for leaks in Instruments. – Whirlwind Dec 22 '16 at 22:39
  • 238MB? how are you getting this number? Is this on the simulator or an actual device? Your memory is going to be mainly dictated by your textures and not your nodes – Mobile Ben Dec 26 '16 at 21:37
  • using the simulator and also my phone, and then using the tools in Xcode to see the memory usage. – NullHypothesis Dec 27 '16 at 20:11

0 Answers0