Eclipse + OS X = unhappy

Eclipse and OS X (10.4 Tiger) makes me unhappy. Today I witnessed something really stupid. I have allocated 768MB for Eclipse (eclipse.ini) and to my amazement, Eclipse was beach balling (being unresponsive for you non-OS X-ers). This beach balling was due to the simple fact that the Java garbage collector was reading in pages from the swap file in order to throw everything away. Woohoo! This took of course over 2 minutes.

I doubt that Java will ever become a consumer technology with this kind of shit.

Tags: , ,

16 Responses to “Eclipse + OS X = unhappy”

  1. Alex says:

    I also encounter a lot of issues with latest distribution of Eclipse (ver. 3.3.2). I’ve allocated 1024MB, but that doesn’t help at all. Eclipse crashes every 5 minutes. This drives me crazy!

  2. Jan says:

    Alex: I also got hit with frequent crashes on OS/X after upgrading to Eclipse 3.3. Turns out there’s a known problem in the OS/X SWT bindings: http://www.cornilliac.com/blog/2008/02/fix-for-eclipse-33-crashing-under-osx-leopard/

    I’m currently running the latest milestone release of 3.4 which works much better.

  3. This isn’t a Java issue. This is actually being caused by the operating system attempting to aggressively page out memory that it perceives as stale. The JVM of course knows better, but it can’t do anything about it because of the virtual memory model. OS X being a desktop operating system tries to determine stale memory based on apps which are running in the background or even which no longer have WS focus. For the most part, this is a good thing, but for long running apps which eat tons of memory (basically, any IDE), it can cause problems like the one you experienced.

    Theoretically, this could be avoided either by the OS being less aggressive in its memory swapping, or by the JVM communicating with the kernel to hint at which bits of memory can be safely swapped. Either fix would be trivial for Apple (because they control the VM on Mac), but I don’t see them actually *doing* it any time soon.

    BTW, I’ve never experienced this problem to the degree you describe on either Windows or Linux.

  4. I agree with Daniel. BTW, I have this issue with NetBeans and any major desktop Java application, including those I’m developing. I never did any specific measurement, but I do believe the problem is indeed caused by the bad GC + swapping interaction. I try to control that by avoiding to allocate too much memory to Java application, I know that a good rule is to avoid passing the amount of physical memory. Of course this effort would be jeopardized if you run multiple applications that would prevent the Java application to reside entirely in memory. Mac OS X is way, way, way worse than Windows or Linux in this case, running the same things in similar configurations I don’t get this crazy trashing on the other two operating systems. You would expect that a custom-made JVM by Apple as the one in Mac OS X would address this kind of issues, and instead it doesn’t.

  5. Alex says:

    I’m running my Eclipse on Windows XP platform and have no idea why this is happening.

  6. Jonathan Locke says:

    i’m using 3.4m6 and it works pretty good.

  7. CAT says:

    I partly agree with that.
    Of course, my Mac OS X is over 1 year old, so memory is the biggest problem since it only got 500MB back then (so I wold not dare to set 1024 ;-)

    Windows and Java in particular also have strange behaviour regarding memory. On Win XP on a 3GB Dell Notebook I constantly got only 2GB usable by the OS despite BIOS accepting all 3GB. Also if you try to allocate over 1024MB (mx option) on most JVMs prior to Java 5 on Windows this does not work at all. There are also known JVM issues with memory over 2GB on Windows, both 32 and 64bit. Some VMs have fixed that (e.g. BEA’s own) but in general this still lags into Java 5 or 6 at least on Windows.

    Coming back to Mac and Eclipse. 3.4 seems a lot better in some areas. Maybe it is just the parts SpringSource has put into their new STS, but RC1 of their Tools Suite based on Ganymede Preview has impressed me by performing a lot better in most similar use cases than e.g. the Europa Java EE Bundle by Eclipse. I may still look for more GB e.g. for Leopard, but those discoveries tend towards a combination of JVM and Eclipse itself (plus Plugins underneath) with a lot of room for their own improvement.

  8. Eelco says:

    I’m using Eclipse 3.3.2 on OSX and I’m very happy with it. It never crashes and is always responsive.

  9. Jonathan Locke says:

    I am a Leopard, not a Tiger. I think Eelco is also a Leopard.

  10. Eelco says:

    Right, I’m on Leopard.

  11. Fernanda says:

    I run Photran and it eats 100% of my CPU and god knows how much ram…now do I fix it? ugh!

  12. Newton says:

    I have run Eclipse on OS X for years and the only problem I had was early on when SWT didn’t play nice on OS X. My guess is that your machine is in general low on memory. Check your activity monitor with just a browser and see how much memory you have available. My guess is that it is pretty low. Leopard takes a lot of memory by itself and all those cool desktop widgets eat even more even when they aren’t being displayed. I have 1gig on my current machine which was plenty under 10.4 but I am going to add another gig with Leopard. Luckily memory is cheap.

  13. How much RAM does your Mac have? For over a year I had 2 GB and most of the time it went very well with Mac OS X (first Tiger, then Leopard) and Eclipse (3.3.2, 3.3.3). When I started running multiple Eclipse instances next to each other plus Oracle XE on a Linux VM and the usual other programs (Firefox, Thunderbird,…) things started to get unbearable slow. I’ve since the upgraded the hard disk in my MacBook Pro to a 7200 rpm drive and added another 2GB of memory. That helped a lot and everything is running fine. I’ve never had problems with crashing Eclipse (except when a memory module was defect).

  14. Well it only happens with Eclipse 3.3 Enterprise Edition on Unix platforms. For example Classic eclipse (*without some plugins e.g. mylyn*) has never crashed on my Debian.

    Anyway, Eclipse is just great for being a powerful platform, SWT is great too, but it is not quite perfect, yet :)

  15. Matthew Peterson says:

    Just use Xcode or any editor that does syntax highlighting instead of wasting time with an IDE……then you can allocate that RAM to JVM instead of to the IDE

  16. Xcode?? That takes up way too much memory. Why not just use vi or emacs on the terminal for coding. In fact, it would really help if you disabled the Mac OSX user interface and just booted into the console. You’d probably not have any more IDE issues then. ;)

    I’m having the same issues and figured that I would just put a hammer through my monitor. The JVM & Kernel quickly stopped bickering and started bi-lateral communications with all parties involved.

Leave a Reply