I'm using XCode 7.0 with iOS 9.0 SDK & ARC, all profiling/testing done on an iPhone 5S with iOS 9. EDIT: for all screenshots, it was a single run: I ran a debug build straight from xcode, and then manually attached Instruments to it. So the screenshots are all from the exact same single test run. This memory growth (per xcode view) is 100% reproducible.
My app downloads ZIP files, unpacks them, and adds them to the camera roll. I've made sure to profile and catch memory leaks (ie. missing CGContextRelease) as well as using #autoreleasepool etc
During unzipping, in xcode I see the memory usage shooting up fast, never-ending until the unzipping finishes, and I cannot explain this because there are no objects in Instruments that I can see being held onto. The memory is never released (per xcode's memory view). At the end of my test run I see 236MB used, with no memory warnings during unzipping. If I use Instruments' allocation tool, I see 50.2MB of heap and anonymous VM used. That's a huge difference!
The first thing I did was assume that [UIImage imageNamed:was to blame (caching etc) because I have quite a few animated UIImageViews, so I spent time removing all imageNamed from my code, and using imageWithContentsOfFile instead. That didn't help at all. I add the unzipped images to the camera roll with iOS 8 Photo framework like this: [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:[NSURL fileURLWithPath:filePath]]
I've spent considerable time pouring through Instruments and web articles but to no avail. Can anyone answer these questions?
Why the discrepancy between xcode memory usage & Instruments -- is this normal?
I assume that these numbers are too high for releasing such an app, and I have to improve this before I upload to app store, right?
Looking at the screenshots below can you make any suggestions where I could start looking for the problem(s)?
Thank you very much in advance for your help. Of course i'll post any source-code that would help, i'm just not sure where to begin...
XCODE MEMORY USAGE 236 MB
INSTRUMENTS
The most common cause of this is your configuration. By default when you run in Xcode, you build in Debug mode. When you profile in Instruments, by default, it builds Release. You can modify your Run and Profile configurations in your scheme to change this.
Related
While profiling an app (which has metal codes for gpu acceleration) Time Profiler Instrument gives the error as in the screenshot:
It says, No configuration information received.
I want to know what kind of configuration is missing and how to configure it. I have also observed that other instruments: Allocations, Leaks, VM Tracker has no issues.
I would make sure OSX, XCode and the device's iOS are all fully up to date and power cycle everything. If that doesn't fix it, I'd temporarily modify the app's deployment target to the highest possible option.
If that doesn't fix it check to see if it happens using the metal demo (XCode->File->New->Project->iOS Game Metal) then look to file a bug with Apple: https://feedbackassistant.apple.com/
I'm using XCode 7.0 with iOS 9.0 SDK & ARC, all profiling/testing done on an iPhone 5S with iOS 9. EDIT: for all screenshots, it was a single run: I ran a debug build straight from xcode, and then manually attached Instruments to it. So the screenshots are all from the exact same single test run. This memory growth (per xcode view) is 100% reproducible.
My app downloads ZIP files, unpacks them, and adds them to the camera roll. I've made sure to profile and catch memory leaks (ie. missing CGContextRelease) as well as using #autoreleasepool etc
During unzipping, in xcode I see the memory usage shooting up fast, never-ending until the unzipping finishes, and I cannot explain this because there are no objects in Instruments that I can see being held onto. The memory is never released (per xcode's memory view). At the end of my test run I see 236MB used, with no memory warnings during unzipping. If I use Instruments' allocation tool, I see 50.2MB of heap and anonymous VM used. That's a huge difference!
The first thing I did was assume that [UIImage imageNamed:was to blame (caching etc) because I have quite a few animated UIImageViews, so I spent time removing all imageNamed from my code, and using imageWithContentsOfFile instead. That didn't help at all. I add the unzipped images to the camera roll with iOS 8 Photo framework like this: [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:[NSURL fileURLWithPath:filePath]]
I've spent considerable time pouring through Instruments and web articles but to no avail. Can anyone answer these questions?
Why the discrepancy between xcode memory usage & Instruments -- is this normal?
I assume that these numbers are too high for releasing such an app, and I have to improve this before I upload to app store, right?
Looking at the screenshots below can you make any suggestions where I could start looking for the problem(s)?
Thank you very much in advance for your help. Of course i'll post any source-code that would help, i'm just not sure where to begin...
XCODE MEMORY USAGE 236 MB
INSTRUMENTS
The most common cause of this is your configuration. By default when you run in Xcode, you build in Debug mode. When you profile in Instruments, by default, it builds Release. You can modify your Run and Profile configurations in your scheme to change this.
I've been having issues lately with the latest version of Xcode 5. About a minute or so after launching CPU usage and Real Memory usage skyrocket. I've seen CPU usage as high as 400% and RAM usage as high as 13GB.
I'm on an i5 iMac with 16GB of RAM.
I've tried uninstalling Xcode and reinstalling, running all Mountain Lion upgrades, fixing recurring header loops, launching Xcode without indexing and a few other issues all to no avail. I'm now at a loss as to what I can do.
I would love suggestions of things to try. I've tried running my project on other i5 iMacs and I don't have this issue.
Thanks everyone.
I had this exact problem over the weekend with my Macbook Air and Xcode5. I tired resetting Xcode back to default, deleting the iOS simulator files, etc.
I've isolated it to it being the Source Control functionality in XCode. The high CPU usage doesn't seem to happen when the affected Project is not open, (Close everything and start a new Xcode project). I've disabled Source Control within XCode and and started using GitX instead, and CPU levels for XCode has dropped back to normal levels (5 - 15%).
I haven't dug deeper into XCode to see what could have triggered it.
I was running at 120% - beachball almost constantly - while idle.
What dropped me down to 1.3% was unchecking "Refresh local status automatically" in the "Source Control" tab in Xcode Preferences.
You can still have "Enable Source Control" and "Refresh Server Status Automatically" and "Add and remove files automatically"
I have actually figured out the cause of this memory issue in the source that I have, it was because one of the 3rd party library used was giving a lot of warnings and may be xcode is trying to do some processing around that. Just for test purpose, I removed the library and some of the classes which used that, and I was able to build the code faster. Now I plan to get to the bottom of the warnings and try to fix it. Not sure if all the people facing these issue is because of this but this was definitely the reason for my problem.
I've submitted a couple bug reports regarding this and while debugging it we came to a conclusion it seems to happen with upgraded projects. By simply removing all the classes from my project then reading them I no longer experience the horrible cpu usage and ram usage. This was primarily happening on 5.0 with my storyboards prior to simply removing them and re-adding them to the project. Xcode 5.0.1 also helped my performance.
*UPDATE
Since updating to Xcode 5.0.2 I no longer see these issues. I can finally work on large storyboards again.
Did you try to access many libraries at the same time or did you run a search trough out the system regarding a Xcode file or a project?This could sometimes bring the issue you have.running so many functions in xcode at the same time can bring these type of problems.if you can reinstall xcode after taking a backup of the data you need.
I just experienced similar issues with xcode after an update yesterday.
My memory on a 16GB macbook pro just dried out every time I opened xcode from 11-12gb of free ram to somewhere between 3-4gb with or without any projects open. I tried deleting the DerivedData folder to no avail.
The only solution that I have found that fixes the issue temporarily is for me to let xcode eat all the memory after starting and then doing a sudo purge in terminal.
After the purge I can work as normal with xcode with any projects using only as much ram as it needs to, but this needs to be done every time I start xcode.
I've been running into a problem with Apple Instruments (4.6, Xcode 4.6.2 on 10.8.3).
Normally when using the Time Profiler, I can look at my source and see the hotspots without any problems (same project).
This time I've been trying to use the "Counters" Template to sample my CPUs Performance Counter Events. It samples the events as it should and I also have the same time based profiling information as well, however when I try to step into my code to look at the hot spots, like I can do for the "Time Profiler", all I get is "Unavailable" where I used to have the source. No Assembly either.
The Project is built as:
Release build
Debugging information is on and not stripped
DWARF + dsym is used to store the profiling data.
As I said, its the same configuration that works for the time profiler.
I already tried to (pretty much all that's stated in here: Xcode 4 Instruments doesn't show source lines , except for doing -O0, debug performance is not of interest to me)
recompile
relocate the dysm file using "File -> Re-Symbolicate"
As soon as I plainly close Instruments, start another Profile from Xcode and choose the Time Profiler, it works, if I go back to the Performance Counters, it stops.
Is this the default behaviour? Should it be like this? Has anybody already managed to get it working, in the current Instruments version? Otherwise it might be worth to file a bug with Apple.
Thanks a lot!
Try the Xcode 5.1 beta4. For me its fixed there: Counter works now.
The seed notes mentions some details what they did. Don't know if its under NDA.
I've been trying to use Xcode 4 on my 1GB Mac Mini. It's not a happy situation. It frequently slows way down, presumably due to memory shortages.
Are there any settings I can change so it won't be such a memory hog?
Another post here suggests that the problem may be having the "predictive compilation turned on in the Xcode preferences."
I ended up doing the following. None of them reduced Xcode's memory consumption, but they did reduce the memory needed by other programs, and hence solved my problem -- speed is fine now.
Start using chrome instead of Firefox
Turn off spotlight and dashboard
Don't auto-launch iTunes