4

Does anyone know how to improve xcodes memory performance. With iOS9 the mem usage jumps to ~4gb i have a macbook pro i5 2.3 8gb But this damn thing is eating everything! At times it takes 2-3 min to switch between swift files or move to another location in the same file.

If i switch to another program (Chrome, slack or skype) those run perfectly fine.
After some monitoring with Instruments i saw the following (Simulator running)

  • After running it for 20min or so the issue also occurs on Instruments
  • I have regular spikes of cpu usage of up to 106% (Not to sure how that works)
  • I got the iOS 8.4 simulator to see if 9 was specifically causing the issue, issue still persists.
  • xcode virtual mem is 5gb
  • xcode real mem stays between 500-750mb and has the occasional jump to ~1gb
  • xcode compressed mem is ~350mb
  • xcode threads climbs to about 32/34 when the issue occurs

Exact issue description
At random intervals(cannot find exact replication steps) xcode will apear to "hang" i am unable to switch between files or scroll on any pane (code, file structure or overview).
Also if I switch to another application while this is happening and switch back xcode will not come into view.
This can occur when xcode or the simulator is not in view.
There doesn't seem to be anything downloading in xcode or on the system.

  • 1
    The site works better if you stick to the "one question per post" rule. You can always ask additional questions if required. – nohillside Sep 21 '15 at 13:11
  • 2
    -1 for lack of detail. Search the site here for how to diagnose virtual memory swapping (search for "vm_stat" or "memory pressure" to start off). You have a problem, but are you looking on how to diagnose OS X performance in general? It's hard to guess if you are someone that was handed a Mac in a junior high program for first time developers or if you know something about virtual memory. – bmike Sep 21 '15 at 13:18
  • IOS9 is the oS on the iPhone do you mean OS X? How much memory do you have and depending on the OS what does activity monitor show? – Mark Sep 21 '15 at 13:23
  • +1 for the details. I'll see if I have time to look at things, but if you're not under memory pressure (vm_stat 5 shows no paging and the pressure is green in Activity Monitor), then it might be CPU constrained. Can you narrow down what you're doing in Xcode? Playgrounds, Interface Builder, Storyboards, editing code or are you running things in a simulator while edit/compile/debug the live code? 30 threads isn't a lot and 100% CPU means the compiler or something else has work to do. The UI shouldn't block there - so I'm in agreement with you on the chance you can "fix" this. – bmike Sep 22 '15 at 14:13
  • I am writing a normal application so I am jumping between code, a storyboard and xib files. I regularly build to the simulator, the app has not been taken live so there is no crash check functionality in use. i am quite a way into the app. However when running the app the simulator only uses 45 mb for the app – Lawgrin Foul Sep 22 '15 at 14:18
1

I can't comment but I am running into the same issue with xcode and have a direction for you to try. Create a new profile on your mac and run xcode from there and check the memory usage for xcode, that should hopefully be down around normal levels. What that means i'm not sure yet, but it could help.

Update:

My problem was caused by too many provisioning profiles, this wasn't an issue I can recall from pre Xcode7, but maybe someone else can enlighten me. Any time any project was opened something happened that cause my xcode usage to spike up to 5.2GB uncompressed, but deleting about 1.5GB of provisioning profiles brought that usage back down to normal levels as described in this thread.

To find the files to delete go to:

${Your_Username}/Library/MobileDevice/Provisioning\ Profiles

  • I don't know about provisioning profiles all mine were not even 1mb big. However I saw I had a lot of old emulation files (if that makes sense) which was around 6/7GB iOS 4.1 - 9.0 files. Is that what you meant? – Lawgrin Foul Oct 29 '15 at 6:50
  • This really did help. There are still times that it happens however it is far more infrequent – Lawgrin Foul Dec 10 '15 at 19:27
2

Since you are developing - fire up Instruments and use it to profile Xcode.

You'll need to determine if storage/io is the cause of the slowdown or if it's CPU or if it's network.

From there, you can ask a follow on question once you have some data on the problem. My guess is Xcode could be downloading the new documentation - check for intalld/active network downloads. Or it could be symbolicating crash logs from all connected devices, or downloading symbol tables from connected devices, or running a sandbox, or ...

Basically, since Xcode is so large a tool, it's hard to know what subsystem you are even using without some data.

FWIW - here's a properly behaving, no simulator running, a dozen other apps running, Xcode done installing documentation Xcode using a hundred meg of RAM while open.

enter image description here

The Mac in question is up 3 days and has has a lot of mongodb and VirtualBox linux VM running which make the kernel larger than it would be at boot, but even that isn't causing any sort of memory pressure.

2

Was having the same problem - investigated and googled whole day yesterday and found out a solution. The problem seems to root from the TOOLTIPS that XCode tries to show for truncated filenames in the left pane of XCode.

So just widen the left pane and this problem no longer occurs for me. Please read my blog if you want details: http://xcodenoobies.blogspot.my/2016/05/how-to-fix-xcode-7-lag_17.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .