4 Replies Latest reply on Apr 28, 2002 4:57 PM by Thomas SMETS

    Why does ps show JBoss using a lot of memory on linux?

    Adrian Brock Master

      Q: When I use ps on my linux machine with JBoss running
      there are multiple java processes running
      each using mega bytes of memory.
      Why does JBoss use so much memory?

      A: It doesn't. JBoss uses threads. On linux each thread appears in the process table which is what ps looks at.
      But the memory for all the threads is shown against
      each thread.
      If you look carefully all the "processes" are using
      exaclty the same amount memory.

        • 1. Re: Why does ps show JBoss using a lot of memory on linux?
          Thomas SMETS Newbie


          Adrian,

          You could give a look @ the different options on the JVM u r using !
          I would suggest U to add the following paramters to your JBoss start up script :
          -Xms32MB -Xmx256MB
          It sets the initial (to 32MB) & maximum (to 256 MB) size of the heap. These values should be worked out when optimizing the envrioment...
          This should confine a little bit the Memory hungry system. It forces regular GC & usually make the application run more smoothly :-)

          To know what flag to set, just type :
          "java" at the prompt. In most case you have the
          "java -X" command propose for the unsupported jvm-options. chack for appropriate syntax.

          Thomas,

          p.s. : My Linux install has very similar option the Win2000 VM does have. I posted you directly the result of the
          java
          &
          java -X command


          • 2. Re: Why does ps show JBoss using a lot of memory on linux?
            greg ewing Newbie

            You are right . Under linux , both ps and top don't distinguish between process mem and thread mem. Thus if you have 100 threads in one process and the process is using 100MB , ps will report 100 java entries each using 100MB. You will notice the total memory usage NOT be 100*100MB .

            • 3. Re: Why does ps show JBoss using a lot of memory on linux?
              Jeffrey Jeffrey Newbie

              I've set the JVM heap size as stated (-Xms32MB and -Xmx256MB), but, from ps output, I still see jboss's VmSize as big as 1.7GB, and my system (with ~700MB physical memory and >1GB swap space) just grinds down to halt. All I did was making about 50 invocations on a SLSB that invoke another 3 EBs with CMP20, and the abnormal menory growth happens within 5 minutes of the invocation. I'm using JBOSS 3.0 RC1 on Linux 2.4.7 with JVM of Blackdown 1.3.1 FCS. Any clue? I saw a bunch of memory leak postings on the forum. Does the latest CVS code fix the problem?

              Thanks,

              --- Jeff

              • 4. Re: Why does ps show JBoss using a lot of memory on linux?
                Thomas SMETS Newbie

                Jeff,

                Do at some point a :
                Runtime.getRuntime ().freeMemory ();
                Runtime.getRuntime ().totalMemory() ;

                You will see that the value return are not consistent with the values shown in "ps".

                Look for other trheads with similar posts.

                Thomas,