(iPhone)Instruments question - iphone

Just wondering if my iPhone application should be running slow when I put it through instruments? When I test my app using instruments, it goes extremely slow and is frustrating to use.
Thanks.

Yes, this is normal as Instruments is constantly monitoring the app's process, which causes the app to run considerably slower than normal.

I faced similar situation. When instrument gathers data, the app seems to hang up. And this is natural.

Yeah, I think that instruments affect your application being monitored. You can/should try in the real Iphone device to see the real performance

Hey.
And more different instruments you load int Instruments the slower it gets.

Related

Phone gets heated when running my application

When I use my application for awhile, I have noticed that the device gets hot. Apple devices usually get hot when running applications, so I want to know if there's a method to check if I have done something wrong in my application.
I don't think the Allocations tool in Instruments could help me diagnose the problem.
Instruments can definitely help you solve this. Your device gets hot as a direct result of intense CPU activity, which Instruments can track and show you your CPU usage and memory allocations.

Memory Usage - iPhone

I was wondering, what is the most accurate way to test how much memory my game application is using on the device? I've been using Instruments with Allocations and Leaks, but the highest it has ever been is 2.22MB (don't get me wrong I'm not complaining at all). Is that accurate? Is that even possible for a game? I use A LOT of images (mostly sprite sheets). Also, when I test it in the simulator it says my application is using 22MB+. I'm just confused. I thought it would be either using the same amount on an actual device or more.
Thanks
Run your app on the device with the Activity Monitor instrument. That should give you an accurate reading of memory usage.

How does the Instruments stop working automatically?

I try to monitor the allocation through Instruments.
However, when I run to a point, sending some jabber msg, the Instruments stop working automatically.
I wonder how does it stop.
Is there any code in an app could stop the Instruments?
I have faced this problem too. The answer i got was: Instruments does stop if your memory usage is too high. Turn on Allocations, and see the memory usage. In my app, I was calling web services, which were downloading some heavy data, because of which my app's memory consumption would go unto like, 60-70 MB, (for an iPad app). This was causing instruments to crash.
So I had to put some memory fixes. I was able to reduce it to around 12 MB. And then Instruments resumed to work fine. Hope it helps.
It could also be as #Cory Kilger suggests and the app is crashing.
Try running it outside of instruments.
Good luck :)

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

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.
What are some things that would cause a game to instantly begin to lag after playing it for a while?
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 reported. 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.

Game crashes on the actual iPhone but simulator? memory problem?

I have built my first game using Cocos2D. It worked fine on the simulator. But when it runs on the actual iPhone, it crashes. I don know why. Thought it was memory leaks, so i tried to detect, but no leaks found. I tried to increase and decrease frame rate, neither both succeeded. Anyone experienced please help me out. I am really stressed now. If anyone had the same issue please share with me your opinion.
Yours thanksfully.
I've run into similar issues (I also use Cocos, but I don't think this is Cocos specific). The best thing to do is plug-in your iPhone and watch the stacktrace when it crashes (or retrieve the stacktrace after the fact)
This happened to me a lot because the resources between the iPhone and the simulator were not in sync; in other words, some how resources would be available to the simulator (eg: images) but those same resources were not transferred to the iPhone for whatever reason. Sometimes, if I ran 'clean' on the simulator, I would observe the same issue.
It's extremely frustrating to debug these types of issues, but you'll get used to it.
I agree with Dominic - we definitely need more information to be able to help you - do you have the output from the console or the stack from the debugger?
Also, while memory leaks are a Bad Thing, they rarely lead to crashes directly. They will increase the amount of memory used by your app so if you're memory intensive then you might get a problem but they're not the first place I'd look to try to debug this.
Try running the app in Instruments and watch the memory usage graph - then not only can you see the total that your app is using but you can get an idea of which sections of your app use the most and can focus your efforts in reducing it.
Sam
Sorry, but you need to specify more details. How does it crash? What does the error log say? One thing you might look into is the amount of memory, your game consumes. If it uses more than 64 MB on the actual device, the OS will very likely just terminate it. In the simulator on the other hand, your app might use lots more memory without a problem.
I have found tools like Instruments and NSZombieEnabled to be very helpful in tracking down issues such as these.
Without more information, I would try the following steps:
Delete the app from the device and simulator (using the tap-and-hold technique to make your icons jiggle) and reinstall it. Sometimes a setting (or lack of a setting) in the user defaults will cause a crash, and those don't get wiped out unless you delete and re-run your app.
Also try the "simulate memory warning" option in the simulator and see if that gets it to crash.