Thursday, December 23, 2004

Performance Tip: Make More Memory Available!

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.


I've seen a couple of customer projects today (thanks for sending those in!), and one thing became obvious: we've set the default maximum heap size for the Java VM too small. It's currently set to 128 Mb; but with the IDE running, lots of data sources, a dozen pages with lots of components on them etc. two of the projects were up in the 120 Mb range when all the pages are open at the same time.



So you should increase the amount of memory you make available to the IDE. This will not only make the IDE run faster (because when the IDE is getting near the memory limit it does a lot more garbage collection), but it will avoid OutOfMemory exceptions and other problems that occur if you actually get up to the limit.



To change the memory limit, do this: locate your IDE installation, and edit bin/ide.cfg with a text editor. It currently looks like this:


-J-Xms24m -J-Xmx128m
-J-Xverify:none
...

Change this into

-J-Xms24m -J-Xmx256m
-J-Xverify:none
...

and restart the IDE.



It's possible some of the Patch 5 symptoms showed up for some of you whose project memory requirements were near the limit, simply because with the extra preview features and other fixes, the IDE is taking up more of the available heap space and you run out of memory.


6 comments:

  1. Actually it might be better to change the line to:



    <CODE>
    -J-Xms128m -J-Xmx256m

    -J-Xverify:none
    </CODE>




    If you know that you'll need that much memory, why start at 24m? Just start off at 128m and save yourself boot time resizing the heap

    ReplyDelete
  2. The most annoying thing on Windows is that it swap you application onto disk as soon as it is in the background, even if you still have more than enough memory free. As Java apps are rather large, restoring them from swap takes a while and your application stucks for few seconds.
    To avoid it, you can tell Windows to only swap when really needed. See this tweak. After applying it, your application (and your entire desktop) will be much more respnsive.

    ReplyDelete
  3. Is there a way to increase memory for Studio Creator?

    ReplyDelete
  4. You mean other than what is described in the above blog entry? Can you be more specific?

    ReplyDelete
  5. I go to the following directory:
    C:\Program Files\Sun\Creator2ea2\bin
    and there is no file named ide.cfg
    Im assuming that you were referring to creator q2 2004 and that the location/name of this config file has changed but I dont know which one it is

    ReplyDelete
  6. Ah yes, its location has changed. It's now etc/creator.conf .

    ReplyDelete