Page 1 of 4 123 ... LastLast
Results 1 to 10 of 34

Thread: How to change memory and other JVM settings for STS

  1. #1
    Join Date
    Sep 2008
    Location
    Hamburg, Germany
    Posts
    1,650

    Default How to change memory and other JVM settings for STS

    STS runs on top of a JVM that is configured at startup with some default values that we think are suitable for many users. Nevertheless users may find other settings more useful for them, especially when using additional extensions for other languages like the Groovy or Scala, a larger heap can improve performance a lot, for example.

    The JVM that STS is running on is configured in the sts.ini file. You can find this in the same place as the STS executable (Mac users might need to dive into the STS.app bundle and there into Contents/MacOS). Open sts.ini and take a look at the default settings (among other settings which you should not touch):

    Code:
    -vmargs
    -Dosgi.requiredJavaVersion=1.5
    -Xmn128m
    -Xms256m
    -Xmx768m
    -Xss1m
    -XX:PermSize=128m
    -XX:MaxPermSize=384m
    Here you can change the maximum heap setting (-Xmx2048m for example) and all the other JVM options that your runtime offers.

    Note: Some operating systems, especially the 32bit ones, restrict the maximum memory setting for a single app to a specific amount, so STS might fail to start the JVM if your settings are not valid on your system. Backing up the sts.ini file before changing it is therefore recommended.

    I would also like to invite everybody to share their optimal settings here, so others can try out!

    Looking forward to reading about your experiences with different settings!

    Best regards,
    -Martin
    Martin Lippert
    SpringSource, a division of VMware
    SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/martinlippert

  2. #2
    Join Date
    Jun 2006
    Location
    SF Bay Area, California
    Posts
    524

    Default

    For reference, here is my STS.ini (based on suggestion from http://www.beyondlinux.com/blog/?p=93). Note that I am running STS on a 8GB Mac.

    Code:
    -startup
    ../../../plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
    --launcher.library
    ../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.100.v20110502
    -product
    com.springsource.sts.ide
    --launcher.defaultAction
    openFile
    -vmargs
    -Dosgi.requiredJavaVersion=1.5
    -XstartOnFirstThread
    -Dorg.eclipse.swt.internal.carbon.smallFonts
    -server
    -Xmn128m
    -Xms1024m
    -Xmx2048m
    -Xss2m
    -XX:PermSize=128m
    -XX:MaxPermSize=512m
    -XX:+UseParallelGC
    Ramnivas Laddad (Follow me on Twitter)
    AspectJ in Action: Enterprise AOP with Spring Applications (2nd edition). Now available!

  3. #3
    Join Date
    Sep 2008
    Location
    Hamburg, Germany
    Posts
    1,650

    Default

    Here is what I am using quite successfully on my 8GB OSX machine:

    Code:
    -vmargs
    -Dosgi.requiredJavaVersion=1.5
    -Xmn128m
    -Xss1m
    -XX:+AggressiveOpts
    -XX:+UseConcMarkSweepGC
    -XX:PermSize=64M
    -XX:MaxPermSize=712M
    -XX:+HeapDumpOnOutOfMemoryError
    -XX:CompileThreshold=200
    -XX:+UseCompressedOops
    -Xverify:none
    -XX:+UseBiasedLocking
    -XX:+UseFastAccessorMethods
    -Xms768m
    -Xmx1280m
    -XstartOnFirstThread
    -Dorg.eclipse.swt.internal.carbon.smallFonts
    Last edited by Martin Lippert; Mar 15th, 2013 at 04:36 AM.
    Martin Lippert
    SpringSource, a division of VMware
    SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/martinlippert

  4. #4
    Join Date
    Jun 2011
    Posts
    14

    Default

    Gentlemen,

    Any idea where I can find documentation to learn more about various parameters in STS.INI (e.g startup, launcher.library, launcher.defaultAction, etc)?

    Regards!

  5. #5
    Join Date
    Sep 2008
    Location
    Hamburg, Germany
    Posts
    1,650

    Default

    Hey!

    The items above -vmargs are specific to the Eclipse-based launchers and should not be touched!!!
    More details on these items can be found here:
    http://help.eclipse.org/indigo/index...e-options.html

    HTH,
    Martin
    Martin Lippert
    SpringSource, a division of VMware
    SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/martinlippert

  6. #6
    Join Date
    Jun 2011
    Posts
    14

    Default

    Thanks Martin! This definitely helps!!

    Regards!

  7. #7
    Join Date
    Feb 2007
    Location
    Huntington Beach, CA
    Posts
    26

    Default

    Hi all,

    I wrote an article on optimizing JVM settings here:

    http://philip.yurchuk.com/2011/08/15...tings-for-sts/

    I'm not a JVM expert, so I tried to give as much detail as possible and listed all my references. Hope it's of use to you.

    Thanks,
    Philip

  8. #8
    Join Date
    Aug 2010
    Location
    Goteborg, Sweden
    Posts
    434

    Default

    Quote Originally Posted by Martin Lippert View Post
    Here is what I am using quite successfully on my 8GB OSX machine:

    Code:
    -XX:+UseFastAccessorMethods

    I think this is default, so shouldn't affect anything.

  9. #9
    Join Date
    Aug 2010
    Location
    Goteborg, Sweden
    Posts
    434

    Default

    Quote Originally Posted by Martin Lippert View Post
    Some operating systems, especially the 32bit ones, restrict the maximum memory setting for a single app to a specific amount, so STS might fail to start the JVM if your settings are not valid on your system. Backing up the sts.ini file before changing it is therefore recommended.
    well, this is true on my G5 with OS X 10.5.8 and jdk 1.5. However, I'm not sure it's simply a max as certain values for the max memory setting —-Xmx — does not take some lower numbers but does take some higher.

    What I'd like to know is how to calculate which values are valid and which are not. Any ideas on this? I can't seem to find the pattern.

    Currently this what I have but I'd like to give much more memory, like 2-3 gigs out of my 8:

    Code:
    -startup
    ../../../plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
    --launcher.library
    ../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.100.v20110502
    -product
    com.springsource.sts.ide
    --launcher.defaultAction
    openFile
    –launcher.XXMaxPermSize
    384M
    -vmargs
    -Dosgi.requiredJavaVersion=1.5
    -Xmn128m
    -Xms768m
    -Xmx1512m
    -Xss2m
    -XX:PermSize=128m
    -XX:MaxPermSize=384m
    -XX:CompileThreshold=100
    -XstartOnFirstThread
    -Dorg.eclipse.swt.internal.carbon.smallFonts
    where settings in bold are what I believe non-default.
    Last edited by MiB; Dec 4th, 2011 at 06:18 AM.

  10. #10
    Join Date
    Sep 2008
    Location
    Hamburg, Germany
    Posts
    1,650

    Default

    Hey!

    I don't know the exact details about how to calculate the exact maximum possible memory settings for a JVM, but according to this:
    http://www.oracle.com/technetwork/ja...#gc_heap_32bit

    it seems at least reasonable to get something between 1.4GB and 1.6GB when running a 32bit JVM.

    HTH,
    Martin
    Martin Lippert
    SpringSource, a division of VMware
    SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/martinlippert

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •