Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

XCode swallowing all memory

Lately, XCode's use of memory has resulted in freezing my machine. This tends to occure during compilation, but not only. No such problems from command line or alternative IDE CodebBlocks with same compiler. Any suggestion for troubleshooting?


Developer Information:

Version: 3.2 (10M2309)
Location: /Developer
Applications:
Xcode: 3.2.4 (1708)
Interface Builder: 3.2.4 (804)
Instruments: 2.7 (3014)
Dashcode: 3.0.2 (333)
SDKs:
Mac OS X:
10.5: (9L31a)
10.6: (10M2309)


Activity Monitor for XCode:

Real 2.51GB
Virtual 15GB
Shared 49MB
Private 2.79GB
Virual Private 4.74

MacBook5,1, Mac OS X (10.6.1)

Posted on Mar 3, 2011 1:19 PM

Reply
Question marked as Best reply

Posted on Mar 4, 2011 9:28 AM

Hi frangipane

Given the problems you're having with Xcode not tabbing properly and now this freezing issue, I'm wondering if your Xcode installation is damaged in some way. There's absolutely no way that Xcode should be causing freezes.

If I were in your position, I would clear out all cache files, then delete Xcode preference files, then run the developer tools de-install script. I would then re-install Xcode and hope this fixes the problem. You probably don't need to download a new version from Apple's web site provided you get no problems when you mount the dmg file.

It's going to take a couple of hours, and when you've done it you may be no better off!

Good luck (you might need it)

Bob
27 replies
Question marked as Best reply

Mar 4, 2011 9:28 AM in response to frangipane

Hi frangipane

Given the problems you're having with Xcode not tabbing properly and now this freezing issue, I'm wondering if your Xcode installation is damaged in some way. There's absolutely no way that Xcode should be causing freezes.

If I were in your position, I would clear out all cache files, then delete Xcode preference files, then run the developer tools de-install script. I would then re-install Xcode and hope this fixes the problem. You probably don't need to download a new version from Apple's web site provided you get no problems when you mount the dmg file.

It's going to take a couple of hours, and when you've done it you may be no better off!

Good luck (you might need it)

Bob

Mar 4, 2011 2:32 PM in response to frangipane

Hi frangipane

frangipane wrote:
"If I were in your position, I would clear out all cache files,"

Specifically, you mean ~/Library/Caches/com.apple.Xcode? FYI 82KB.


You might as well clear out ALL cache files. It won't do any harm and can reclaim some disk space. More information here:
http://hints.macworld.com/article.php?story=20060111202501460

Be sure to reboot immediately after the files have been deleted.

"then delete Xcode preference files,"

Where are they?


Now I look, I see it's just one file:
~/Library/Preferences/com.apple.Xcode.plist

"then run the developer tools de-install script. "

- Where is it?


/Developer/Library/uninstall-devtools

This is Unix command script so you might prefer to execute it from the Terminal program with these commands:
cd /Developer/Library/
./uninstall-devtools

- Wouldn't a de-install script be responsible for the above tasks?!


No. Most uninstallers never bother deleting cache files, and they tend to leave preference files alone so they're still there if the application is re-installed. In this instance, it's quite possible that the cache files and/or the preference files are corrupted so we want to get rid of them just in case.

Good luck

Bob

Mar 25, 2011 4:39 AM in response to Bob Lang1

Having the same issue here, my machine doesn't freeze but starts to be slow and "laggy" in any task.
I followed ure above instructions with no success, still the same problem.
By now im writing this post with xCode 4 (64bit) running and with an open project (~2MB source code) and from what i can see using "Activity Monitor" it's using 2,31 GB.

Those are the specs of my Mac Mini ( unibody 2010 )
P8600 Intel processor 2.4Ghz
2 GB DDR3 1066Mhz

I really cannot understand how an application like xCode could use all that Ram...

Any help or suggestion would be really appreciated

Mar 26, 2011 11:15 AM in response to K T

I'm experiencing the exact same problem with a 4GB Macbook Pro.
Free memory goes down to about 10MB and then the swapping starts, causing the slowdown of the whole system, e.g.: simply starting the console or dashboard then takes minutes(!) to load.

A memory upgrade might not fix the issue, because if it's caused by a leak then it will eat up all the resources again as well, no matter how much ram you have available.

In my case it always seems to be InterfaceBuilder related and sometimes switching back to the code view will free up ~2GB of memory, so that the system becomes responsive again rather quickly.
However, in other cases the memory usage doesn't change even after quitting XCode and takes minutes before the GC kicks in to free up some memory again.

It also doesn't matter if I'm just running XCode or have other apps running as well. After a while XCode starts eating up all available memory causing a slowdown again.

Apr 5, 2011 3:47 AM in response to K T

KT ure a genius, it's just like to say that my car uses too much gas to run and ure responding just to buy more gas. C'mon seriously, i've no money to waste in unuseful ram or time to waste readin' this kind of things. If u wanna talk on how much useful is ram in a von Neumann machine than you came in the wrong place, here we're talking about an application bug, try on answers.yahoo.com.
Please
Any kind of technical and useful answer will be really appreciated!

Message was edited by: 0xDEADBEAF

Jun 6, 2011 2:12 AM in response to K T

I have the exact same problem. I tried going form 4GB to 8GB ram on my Mac Book pro but it didn't help. XCode 4 is a huge memory hog. The longer I use it, the more it gobbles up.


The solution, for now, is to relaunch XCode every once in a while. It's fairly fast and really helps with the memory issues.


XCode 4 also uses a lot of CPU. So, doing development on a Mac Mini with 2 GB of RAM must be pretty painful. In my 20+ years of doing development, I have found that developer tools always need high end machines. But, XCode 4 has some serious memory problems right now that I'm sure they are working on. Until then, relaunch it from time to time.

Jun 9, 2011 10:06 AM in response to frangipane

Yep - XCode 4.0.2 just keeps eating memory. Ive got 12GB in a 2011 iMac i5 - after about 4-5 hours, its chock full. Restarting XCode only takes a few seconds and solves the problem.


I have seen XCode release the memory if it sits idle for 1/2 hour or so. Makes me wonder if garbage collection in the XCode app that has run-amok. (none of my projects use garbage collection)

Sep 18, 2011 5:52 AM in response to frangipane

I'm with frangipane - my machine is thrashing unusably, and it might as well have frozen.


I have a 5-year old iMac with 2Gb of RAM. It ran Snow Leopard and Xcode 3 quite well.


Very recently I shifted to Lion (the machine has a Core 2 Duo) and Xcode 4. So far I have only compiled "Hello World" type programs, as I'm trying to learn the new layout and settings. I very soon find that I have about 600 Mbytes of "inactive" memory and almost no free memory. If I try to do anything the disk drive whirrs, and I get a lot of swapping - it seems that the "inactive" memory isn't being given back. It got so bad that I eventually force-quit Xcode, and even then the machine took a while to react and stop frantically swapping.


I have tried the purge command in a terminal. It has helped. But I'd much rather have the "inactive" memory given back freely. Is there any way of disabling the "inactive memory" mechanism?


I was going to buy a new machine fairly soon anyway, but I'm annoyed that the software upgrade has changed my current machine from being useful to being quite useless for development.

Oct 27, 2011 8:19 AM in response to frangipane

I probably have the same issue. I'm using an iMac running Lion with 8GB of memory, and xcode would swallow +6GB of memory! After doing some research and trials, it looked like xcode would do this with only one particular project. So I went and deleted the projects caches (i.e. ~/Library/Developer/xcode/DerivedData). And Bam! xcode works again with the normal amount of memory needed, about 150 to 200 MB.


Another note is that this project is on a dropbox folder, so I could use it on multiple machines (an iMac and a MB Air). And someone has noted that this may have to do with the Resume feature of Lion. So I also deleted the file: ~/Library/Saved Application State/com.apple.dt.Xcode.Lion.savedState.


Now xcode is working great! Hope this helps someone.


Cheers,

Mota

XCode swallowing all memory

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.