Proper use of JVM XMs and XMx settings

I've configured Tomcat to run with -XMs1024m -XMx1024m, and am interested to know GC performs when the -XMs and XMx are the same value.
Would it generally be better to have a lower -xms value?

The -XMs only tells the VM how much memory to initially allocate, and doesn't have any correlation with normal operation of GC. I've used -XMs in the past when I know my memory requirements are pretty large, and that way will keep the VM from continuing to dynamically allocate more and more memory up to the XMx setting.

Similar Messages

  • JVM Java heap space Error || even with -Xms- and -Xmx commands

    hi all, i got a problem by allocating a very great boolean array.
    first of all, here is my testcode:
    public static void main(String[] args) {
              boolean[] testfield = new boolean[70000000];          
              while(true){
              //NOP     
         }as you see, i try to allocate an array with 70.000.000 boolean values - as 1 boolean may be represented as at least one physical bit we calculate the total amount of needed RAM-Space:
    70.000.000 bit / 8 = 8750000 byte
    8.750.000 byte = 8.75 MByte
    My System ist WinVista Ultimate 64-bit running on a Quadcore T2200 with 2GB-DDR3 RAM
    Looking in my Vista Ressourcemanager shows, that eclipse.exe reserves about 1.023 Mbyte....
    As IDE I use eclipse
    my eclipse.ini looks as follows:
    -showsplash
    org.eclipse.platform
    --launcher.XXMaxPermSize
    256M
    -vmargs
    -Dosgi.requiredJavaVersion=1.5
    -Xms512m
    -Xmx1024m
    -XX:PermSize=512mby using following VMCommand "-XX:+PrintGCDetails" and running the above code the output displays:
    [GC [DefNew: 180K->63K(960K), 0.0008311 secs][Tenured: 43K->107K(4096K), 0.0060371 secs] 180K->107K(5056K), 0.0069249 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
    [Full GC [Tenured: 107K->105K(60544K), 0.0044835 secs] 107K->105K(61504K), [Perm : 17K->16K(12288K)], 0.0045553 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
         at termain.main(termain.java:15)
    Heap
    def new generation   total 4544K, used 163K [0x246a0000, 0x24b80000, 0x24b80000)
      eden space 4096K,   4% used [0x246a0000, 0x246c8fe0, 0x24aa0000)
      from space 448K,   0% used [0x24aa0000, 0x24aa0000, 0x24b10000)
      to   space 448K,   0% used [0x24b10000, 0x24b10000, 0x24b80000)
    tenured generation   total 60544K, used 105K [0x24b80000, 0x286a0000, 0x286a0000)
       the space 60544K,   0% used [0x24b80000, 0x24b9a420, 0x24b9a600, 0x286a0000)
    compacting perm gen  total 12288K, used 16K [0x286a0000, 0x292a0000, 0x2c6a0000)
       the space 12288K,   0% used [0x286a0000, 0x286a41c0, 0x286a4200, 0x292a0000)
        ro space 8192K,  62% used [0x2c6a0000, 0x2cba2ba0, 0x2cba2c00, 0x2cea0000)
        rw space 12288K,  52% used [0x2cea0000, 0x2d4e88e0, 0x2d4e8a00, 0x2daa0000)so can anyone tell me please, how i manage to allocate bigger arrays? or where at least is the problem?
    Originally i was thinking like that way: Integer.MAXVALUE = (2^32)-1
    => biggest index an array can have
    => biggest allocation possible with ints weights (((2^32)-^1)/8)/1000*1000 = (round) 537 MByte < 2GByte => everything fine .... but it seems like not :-(
    When i try to allocate 60.0000.000 it works fine....but that is far not enough :-&
    thank you very much for your helping answers!

    The Sun Java virtual machine stores booleans as bytes, not bits, so for an array of 70 million booleans you need 70 million bytes, plus 8 bytes for the object header, and 4 bytes for the array length.
    I suspect that your eclipse.ini controls the JVM running the Eclipse IDE, not the JVM running your application. Note that in the -XX:+PrintGCDetails output at the end, it shows you running out of memory with 4MB of young generation and 60MB of old generation. That's the default configuration, as if you hadn't specified -Xms and -Xmx.
    The array of 60 million booleans only requires 60 million bytes (plus overhead), which fits in the default old generation.
    I think you need to put the -Xms and -Xmx in the same place you put the -XX:+PrintGCDetails, since that does seem to display information about the JVM running your application, not the JVM running Eclipse.

  • Xms and Xmx parameters

    Hi, on a windows machine with jdk1.3 I start oracle's oc4j(standalone) from commandline. I specify Xms and Xmx parameters. Hence;
    java -Xms512M -Xmx512M -jar oc4j.jar
    is the command line command.
    But after I start the app server, when I look at the Window's task manager the java. exe has about 50M memory usage. Is there something wrong???
    Thanks all.

    The best option is to set it in setDomain.cmd/sh OR comEnv.cmd/sh depending on your WLS version, since even if you are starting your manage servers from commandline rather than using nodemanager, it will internally use this to set the environment.
    However if you are using nodemanager, you might try "server start" tab for passing JVM arguments.
    For windows service try the following link:
    http://e-docs.bea.com/wls/docs103/server_start/winservice.html#wp1186212 ----> its for WLS10.3

  • Why are -Xms and -Xmx limits so small?

    On a Win XP machine with 3GB of installed memory, the limits for -Xms and -Xmx are 1GB. My knapsack program works for small inputs (< 20 objects). But for real world problems it crashes immediately with an out-of-memory error. What possible harm could it do to allow a Java user to increase -Xms and -Xmx to 2 or 3 GB, or even larger? I would not care if it thrashed, if it finally came up with a good answer.

    CHE22 wrote:
    CHE22 wrote:
    On a Win XP machine with 3GB of installed memory, the limits for -Xms and -Xmx are 1GB.
    tschodt wrote:
    How did you arrive at that?
    By reading this:
    http://java.sun.com/j2se/reference/whitepapers/memorymanagement_whitepaper.pdf.
    I guess you are referring to
    Automatic Selection of Collector, Heap Sizes, and Virtual Machine
    A server-class machine is defined to be one with
    • 2 or more physical processors and
    • 2 or more gigabytes of physical memory
    13 Ergonomics - Automatic Selections and Behavior Tuning Sun Microsystems, Inc.
    This definition of a server-class machine applies to all platforms, with the exception of 32-bit platforms running a version of the Windows operating system.
    On machines that are not server-class machines, the default values for JVM, garbage collector, and heap sizes are
    • the client JVM
    • the serial garbage collector
    • Initial heap size of 4MB
    • Maximum heap size of 64MB
    On a server-class machine, the JVM is always the server JVM unless you explicitly specify the -client
    command line option to request the client JVM. On a server-class machine running the server JVM, the default
    garbage collector is the parallel collector. Otherwise, the default is the serial collector.
    On a server-class machine running either JVM (client or server) with the parallel garbage collector, the default initial and maximum heap sizes are
    • Initial heap size of 1/64th of the physical memory, up to 1GB. (Note that the minimum initial heap size is 32MB, since a server-class machine is defined to have at least 2GB of memory and 1/64th of 2GB is 32MB.)
    • Maximum heap size of 1/4th of the physical memory, up to 1GB.
    Otherwise, the same default sizes as for non-server-class machines are used (4MB initial heap size and 64MB maximum heap size). Default values can always be overridden by command line options. Relevant options are shown in Section 8.And you missed that it said default.
    And by adding any small integer to 1 in -Xms1G.Show us exactly what you specified, do you realize that-Xms11Gmeans 11 GB, much larger than 32-bit Windows can handle.

  • How can I set VM parameters except Xms and Xmx?

    I can set the Xms and Xmx as the following:
    <j2se version="1.4+" initial-heap-size="80m" max-heap-size="80m"/>
    but how can I set other VM parameter such as Xmn,XX:SurvivorRatio,and some which to special JVM(for example:JRockit)?

    There is a whole list ov vm-args considered "safe" by java web start listed in the developers guide at:
    http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/syntax.html#resources
    these can be set with the new arg to the j2se element, vm-args like this:
    <j2se version="1.5.0+" java-vm-args="-esa -Xnoclassgc"/>
    /Andy

  • The impact of java.ext.dirs and XMX settings to a JVM

    Hello,
    I've been using a XMX setting of 3800M for a particular JVM running a particular task.
    However, if I pass the -Djava.ext.dirs option, and point it to some directories, the JVM fails for the same task I've been running in my first run.
    truss output appears to show the failure occurring during mmap() resulting in ENOMEM.
    The question is, under what condition would java.ext.dirs change the behavior of my XMX setting? If it take it out, it runs fine.
    Java version: 1.4.1, SunOS Sparc

    This sounds like a problem I had a while ago that stumped me for several days.
    If your class with the "main" method is loaded from the extensions directory (java.ext.dirs), it appears that a special classloader is used to do that, not the standard classloader that looks in the classpath. This special classloader appears to ignore the classpath and look only in the extensions directory. Also, the JVM appears to try this classloader before the standard classloader.
    Now, when one class wants to load another class, it always uses the classloader that loaded it to load that other class (unless you specifically write your program to use some other classloader). So what is happening to you is this: The "extensions classloader" loads your class with the "main" method, because it can. Then your "main" method tries to load another class, but it uses the "extensions classloader" to do that. And the "extensions classloader" doesn't look in the classpath, and what you saw is what you got.
    At least the answer to your problem is clear: Don't do that.

  • What do -Xms and -Xmx do?

    I know what they are supposed to do, but am unable to see any tangible results from setting them...

    On my machine they do exactly what they're supposed to...that is, to set the initial and max memory available for a program. I wrote two programs to test this :
      //this shows how much memory is available at start up
      public void main(String args[]) {
        System.out.println(Runtime.getRuntime().freeMemory());
      //this outputs how many KB memory the program sucked before crashing.
      public static void main(String args[]) throws Exception {
        Vector vec = new Vector();
        int i = 0;
        try {
          while (true) {
            vec.add(new byte[1024]);
            ++i;
        } finally {
          System.out.println(i);
        }When I run the first program w/o -x set, I get around 1.5 mb (1760896 bytes); when I invoke it with -Xms16m it returns 16 mb (16440960 bytes). The second program crashes at around 64mb (63633 to be exact). Invoking it with -Xmx16m crashes it at 16 mb, as expected (15813).
    Both -Xmx and -Xms are unsupported options...thus their effects are implementation-dependent. It's thus possible that your implementation doesn't support them. (I'm running this on Win2000 using Sun's JVM 1.4.1_01-b01.)
    The only other thought that occurs to me is that you're sending the wrong parameters...-Xms16 means you want to set the initial stack to 16 bytes, obviously something that would have little effect. -Xms16k would be 16kbytes, -Xms16m is in megabytes.

  • Parameters Xms and Xmx

    Hi guys,
    I put the parameters "-server -Xms768m -Xmx1024m" in java options from my instance at Oracle Application 10g and don´t work.
    The instance started, but the parameters don´t work.
    I have Linux with Oracle Application Server 10g.
    What can be?
    Regards,

    I did some testing with an OC4J instance set to a 256 minimum and 512 maximum. When I restart the instance the memory hangs around 65MB. When I start increasing the load on the server the memory increases rapidly to the 128 range, but not to 256. Once I got to 256 I get OutOfMemory exceptions.
    I think the other responders may have it right when they say the JVM is not going to just allocate a huge chunk of memory when it has no use for it. I have seen other cases where the JVM acts this same way with Oracle's CMSDK nodes. Even if you set mins and maxs, memory will only get used when it is needed.

  • Newbie Question: Java -Xmx and other settings...

    Hi all I have a simple question,
    I know that you can use the -Xms and -Xmx to set the heap size, but when I run this command is it permanent or do I have to set it each time I boot up my Windows system? How do tell what the current heap size is?
    I would be grateful for any help.
    Thanks!

    My dear Friend,
    if you are running your program with
    java -Xmx 1024 -Xms 500 ....
    This values you are using are like jvm arguments and you have to provide them everytime you are running your program.....
    Regards,

  • Option -splash and -Xmx result in "Unable to launch JVM" error

    Hello everybody,
    we have a severe problem with launching our Java application using the "-splash:" and "-Xmx" command line options for which we cannot find any solution in the web. Our application needs a lot of heap space, so we usually set "-Xmx=920M". Usually, we are working with Java 6 and use the "-splash:" option to show a splash screen while the application is loading. In some cases, we get an "Unable to launch JVM" error now. This happens only on particular customer systems (servers as well as desktop machines) and the only solution is to decrease the maximum heap size for a couple hundred megabytes. The latter is usually unacceptable since our application requires a lot of heap memory and the machines do have more than sufficient memory. The other option is to completely remove the "-splash:" option, but then there is of course no splash screen anymore.
    Unfortunately, we are unable to track the error back and to figure what exactly is going wrong. Does anyone of you have any hints how to debug or analyze the error? Our assumption is that something is wrong due to memory partitioning which leads to unsufficiently large memory partitions to allocate the required heap memory by the JVM.
    Any ideas?
    Thank you very much.
    Regards
    Timo Rohrberg
    Software Developer, initplan GmbH

    910396 wrote:
    This happens only on particular customer systems (servers as well as desktop machines) Red flag: it is not consistent, in other words it is system dependent. It is already hard for you to diagnose such an occurrence, I wouldn't expect anything more by asking in a forum. At least you have SOME way of doing some more diagnosing.
    I'm sorry, but you'll have to dive in deep. Figure out what update versions of Java the failing machines are running. Which OS. Which processor architecture. Etc. See if there is a common factor involved. If not, hunt through release notes of newer JDKs to see if any of them mention something related to the splash screen and if you find something, let the client attempt an update of the JDK on such a failing machine to see if the problem is remedied. If it is windows, try running with the server VM (java -server) in stead of the default client VM, if you are not already doing that.
    And yeah if all that fails and nobody else has something to add, I'm sorry to say that Oracle support will be your next logical step.

  • I have a iPhone 5.  In usage, it says i have 2.1 gigs used because of photos and camera.  I have deleted all my photos via iPhoto and now reset the phone back to factory settings in order to try to solve this problem, to no avail. Help!

    I have a iPhone 5.  In usage, it says i have 2.1 gigs used because of photos and camera.  I have deleted all my photos via iPhoto and now reset the phone back to factory settings in order to try to solve this problem, to no avail.   Both iTunes  and the phone say that 2.1 gigs are being used, even though the phone now has nothing on it.  What is going on?

    Yeah it works fine over wifi the problem is when I try to use it over my 3G. It's really stressing me out now.

  • I am using a Photoshop cs2, and I wonder if it is possible to keep the settings of the guidelines when closing an image, with the actual document ? It would be nice to have the guidelines locked down, I find it than when opening the same or another image,

    I am using a Photoshop cs2, and I wonder if it is possible to keep the settings of the guidelines when closing an image, with the actual document ? It would be nice to have the guidelines locked down, I find it than when opening the same or another image, the guidelines are not locked, it is annoying to have to lock them down again. and it would actually be nice, to ba able to give specific directions when placing the guidelines. Thanks

    Then why are the guides unlocked when I reopen a document that I saved with the guides locked ?
    Thanks.

  • How do i run an external monitor with my macbook and change settings so that when i close the lid the signal to the monitor is not lost and i can continue using the mac with a mouse and a wireless keyboard?

    How do i run an external monitor with my macbook and change settings so that when i close the lid the signal to the monitor is not lost and i can continue using the mac with a mouse and a wireless keyboard?

    No, nothing will prevent the computer from going to sleep when you close its display except third-party hacks that are designed to do exactly that. I strongly advise against using any of those, as they may interfere with successful entry into clamshell mode (and they carry other downside risks as well). Just wait until the computer is asleep (with its sleep light pulsing), then press any key on the keyboard. It sounds as though your setup is working as it's designed to do.

  • Hi. I am using the iPhone 4S and when I'm searching for places using Google it does not automatically detect my location. How do I change this?  FYI...under settings i

    Hi. I am using the iPhone 4S and when I'm searching for places using Google it does not automatically detect my location. How do I change this?  FYI...under settings i

    If you are missing using google maps - try the Nokia map app called "here"

  • Hi. I am using the iPhone 4S and when I'm searching for places using Google it does not automatically detect my location. How do I change this? FYI...under settings i have it set at "Use new precise locations from my device."

    Hi. I am using the iPhone 4S and when I'm searching for places using Google it does not automatically detect my location. How do I change this? FYI...under settings i have it set at "Use new precise locations from my device."

    If you are missing using google maps - try the Nokia map app called "here"

Maybe you are looking for