2 Replies Latest reply: Mar 4, 2013 6:30 PM by 994752 RSS

    Why does my java need so much memory?

    994752
      Hi,
      fairly new to java user here, trying to understand why java on one of my servers requires so much memory to run.
      The server is centos 6.3 64-bit, 32G of ram.

      [~]# ulimit -S -v "1400000"; java -Xms32m -Xmx32m -version
      #
      # There is insufficient memory for the Java Runtime Environment to continue.
      # pthread_getattr_np
      # An error report file with more information is saved as:
      # /home/xxxxx/hs_err_pid25608.log
      Aborted

      [~]# ulimit -S -v "1500000"; java -Xms32m -Xmx32m -version
      java version "1.7.0_15"
      Java(TM) SE Runtime Environment (build 1.7.0_15-b03)
      Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

      As you can see, I need to provide virtual memory ulimit of almost 1.5Gb for simple java -version to run. On another, similarly configured server (same os, also 64-bit, less ram though) about 400M is sufficient. Java processes occasionally die on the problematic server with out of memory even though plenty of ram and swap are available, and I suspect this has something to do with some misconfiguration which is also behind this absurd memory requirements for a bare vm to execute -version on this server.

      Anyone can help me?
      Thanks in advance

      Edited by: 991749 on Mar 4, 2013 4:04 PM
        • 1. Re: Why does my java need so much memory?
          gimbal2
          Suffice it to say this is really abnormal behavior, especially when you give a max heap of 32mb. Even the 400mb result seems quite excessive. I would rather scout around some centos forums to see what might cause this to happen or for some pointers on tracking down the cause through the os. You could also experiment with openjdk, to see if you get different results that way.
          • 2. Re: Why does my java need so much memory?
            994752
            Thanks for the reply.
            Actually, I realized the other server is 5.9, not 6.2. After doing some more reading I suspect this may be the manifestation of the new allocator behavior https://bugzilla.redhat.com/show_bug.cgi?id=640286
            I've found comments such as this: "Many applications will see a large increase in virtual memory usage (but not resident memory) when running on RHEL 6 vs RHEL 5"