I'm trying to make a kind of 360° visualizer with spriteKit. In my scene i create a
spriteArray = [[NSMutableArray alloc] init];
and i'm filling it in this way:
for ( int j=0; j<stepsY+1; j++)
{
NSMutableArray * innerArray = [[NSMutableArray alloc] init];
for ( int i=0; i<stepsX+1; i++) {
SKTexture *t = [SKTexture textureWithImageNamed:[NSString stringWithFormat:@"img_0_%d_%d.jpg", (stepsY-j),(stepsX-i)]];
[innerArray addObject:t];
}
[spriteArray addObject:innerArray];
}
for example i will have a two dimensional array 4x23; with four steps for y axis and 23 step for x axis; on
- (void) touchesMoved: (NSSet *)touches withEvent:(UIEvent *)event
i'm using
[sprite setTexture:....];
to set the right texture to visualize;
When i'm running it on the simulator it works perfectly but when i try on the real device, when i'm filling the spriteArray the app crashes and xcode is telling me "Terminated due to Memory Error"; So i checked the use of ram in simulator and i recognize that is huge... 1.5gb; my texture are 1220x1220 jpg each one around 50kb.... so it's seems that there is a kind of memory leak somewhere.
Can somebody help me please?
Thanks