Hey all!
I'm currently trying to optimize my app; there are some requests about crashing on old devices and i knew that the app is sometime using a lot of memory.
So, i'm checking for leaks, optimizing pictures and building atlases where there were none yet. So far, so good. But now, i'm coming up with a few questions i'm stucked:
- I went to some functions with moving a return statement on different places (to find the points and amount the memory usage grows) and discovered the following behavior i don't understand:
-> I alloc an image that is coming from an atlas which has been alloced a long time before. Theres almost no memory increase when creating the SPImage. Two lines later, i would like to add this image to my Sprite; guess what: my memory usage (instruments, on iPhone 4s-Device) is increasing by 16.02 MB !! Just by calling "addChild". My Atlas-Picture takes around 7 MB on disk, and the texture I'm taking of it has 377x377px.
Whats going on here?
NSString *myPicFile = [NSString stringWithFormat:@"tp_%@", myActualSetting];
settedImage = [SPImage imageWithTexture:[atlas textureByName:myPicFile]];
// Increases Memory by 0.3 MB
[self addChild:settedImage];
// increases memory by 16.2 MB !!!- And generally: Does an atlas save a lot of memory? After some changes, it doesn't seems so, it's just running significant faster and smoother, but memory-usage hasn't a big change ... ?
Thanks for your advices!
PS: I found an old thread about same issue, but there isn't an helpful answer at all:
http://forum.sparrow-framework.org/topic/addchildimage-uses-alot-of-memory