5

I hope someone can help me find an answer to this problem. I filed a bug report to apple a few weeks ago (28684035) but they have not responded to my report yet. The apple forum is no help either. My game is in development and it sometimes crashes at pre-loading time when all I do is call the method SKTextureAtlas preloadWithCompletionHandler.

Please see the details below. If you have any questions regarding the problem, please feel free to post.

Summary: I created a test project, and simply added the following code in touchUpAtPoint:

SKTextureAtlas* atlas = [SKTextureAtlas atlasNamed:@"GlobalMap"];

[atlas preloadWithCompletionHandler:^{

}];

I looked at instruments and it shows memory leaks whenever this method is called. It crashes eventually. I discovered this leak because in my ongoing game project, I preload several of my atlases at the beginning of the game. It started crashing when I updated my code to XCODE 8.0 and my iPhone to IOS 10.0

Steps to Reproduce:

  1. Create a test project
  2. Add an atlas to the project
  3. Add the preloadWithCompletionHandler code.
  4. Run the app and monitor memory aloocation and leaks in Instruments
  5. Touch the screen several times (or even once - you'll see some leaks)

Version: iOS 10.0.2 Configuration: iPhone 6

JamesM
  • 61
  • 1
  • Ugh... And I am just about to update. By the way, how do you create your atlas? What your completion block does? Also why would you create an atlas on every touch? That is not a usual thing to do. Create a property. And why would you preload same atlas multiple times? Again, that is not a usual thing you are going to do anyways. You preload once and then use it. Correct me if I am not picturizing your situation correctly. – Whirlwind Oct 29 '16 at 22:11
  • 1
    The steps I outlined is just to replicate the problem. It's just a test to show what the problem is. The completion block does nothing. In my real game project, I do preload only once and keep the atlas for the rest of the game. You'll see the memory leak in instruments even if you follow the steps and touch only once. – JamesM Oct 30 '16 at 00:38
  • I see. Just wanted to be sure what is going on. Anyways, you are right, it sholdn't crash or produce leaks. Big chances that is a bug and hopefully Apple will review your submission. – Whirlwind Oct 30 '16 at 06:01
  • Can you elaborate, I do not see any issues with leaks. @Whirlwind, what would you be updating, your iOS to 10? I would not do it lol it is such a mess. – Knight0fDragon Oct 30 '16 at 07:55
  • @Knight0fDragon I am about to update OSX, Xcode and iOS to the latest versions :) At least that was a plan ... But I am becoming very hesitant about this. – Whirlwind Oct 30 '16 at 08:06
  • @Whirlwind, I have yet to go to Sierra, but I did update Xcode and iOS, and I hate it. btw, I would recommend to wait till at least Xcode 8.1, they left some debugging messages in that flood the console, making it useless – Knight0fDragon Oct 30 '16 at 08:08
  • @Knight0fDragon Oh those forgoten console messages sucks big time! – Whirlwind Oct 30 '16 at 08:10
  • @JamesM Have you ever find a solution to this? – damirstuhec Nov 25 '16 at 07:40
  • @damirstuhec Apple still has not responded to my bug report. As a workaround, I removed all preloadWithCompletionHandler code and I created my own preloading by creating SKSpriteNodes for each atlas that I want to preload and then adding them to my loading scene. I made the sprites invisible by assigning -100 to their zposition. – JamesM Nov 28 '16 at 20:19
  • Did Apple respond? I ran into the same issue today with Xcode 8.3 (8E3004b) on Sierra 10.12.6 (16G12b). – Klaas Jul 10 '17 at 14:14
  • Maybe related: https://stackoverflow.com/questions/40834615/spritekit-performance-hit-while-preloading-sktextureatlas – Klaas Jul 10 '17 at 15:01
  • And another similar case: https://stackoverflow.com/questions/22480962/nsgenericexception-reason-collection-nsconcretemaptable-xxx – Klaas Jul 10 '17 at 15:14

0 Answers0