开发者

iOS Development: What are some ways I can troubleshoot a lag issue in my game that occurs 15 - 30 minutes after playing it?

开发者 https://www.devze.com 2023-01-28 18:54 出处:网络
I\'m building an iOS puzzle game to become familiar with the platform and a few of my testers are noticing a severe lag issue that occurs intermittently about 15 to 30 minutes after playing it and the

I'm building an iOS puzzle game to become familiar with the platform and a few of my testers are noticing a severe lag issue that occurs intermittently about 15 to 30 minutes after playing it and the lag doesn't appear to be associated with any specific part of the game. I've tested the app using the Leaks instrument and havent found any leaks yet.

  1. What are some things that would cause a game to instantly begin to lag after playing it for a while?
  2. What are some methods/tools I could use to troubleshoot the lag?

Thanks so much for your wisdom!

UPDATE: As a new iOS developer, I was under the impression that the Leaks instrument would report at least most of my memory leaks, so I was very comfortable believing my app was managing memory properly when no leaks were rep开发者_如何学编程orted. Not the case! After following a few of the suggestions posted here, I watched a few videos on how to use the Allocations instrument and found that my app was losing a TON of memory over time and, after spending about two hours walking through ALL my code and fixing memory-related code, my game is no longer lagging or reporting any lost memory or memory leaks. Thanks, all!


The main thing would probably be a memory warning, which would in turn cause a bunch of game assets possibly to be freed all at once...

Instead of leaks, the place to start is the ObjectAlloc tool. Leaks only shows you memory used your application already knows about. ObjectAlloc shows you the total memory used, and the real issue would be seeing the graph of memory used climb over time.

Lastly, I would try to get the game into that state while using the TimeProfiler instrument, so that you could see what kinds of operations took up a lot of time suddenly when the game slowed down. You have to do that on device, it will not tell you what is really going on using the simulator.


check to see if you are getting a memory warning. also, try using the heap shot tool in instruments, as something could be holding on to a reference, and stopping objects from deallocating, this doesnt show up as a standard leak. i would definitely have a look at the object allocation tool, and keep an eye on objects still living.

if you haven't used instruments much, I think apple have some videos up on the dev site going through them.


Are you using leaks with the simulator or with an actual phone? I have found the simulator to have different results than a phone when running leaks. Based on your description it sounds like you have some leaks occurring.


I have had some similar feedbacks while battery runs low. So, you can check, does issue reproduce when device is powered, or not.

Also, do you use openGL in your game? I'm asking because i've observed some lags with first-time appeared textures drawing, although these textures were previously preloaded and cached.

And last question, what devices your testers are working with?


LEAKS are NOT the same as excessive memory allocation.

It sounds like you are just not releasing things that don't need to be around anymore and you're maxing out on memory and chunking.

Check your allocations and keep an eye on what keeps expanding when it shouldn't.

0

精彩评论

暂无评论...
验证码 换一张
取 消