2 Replies Latest reply on Jul 15, 2013 6:27 AM by puthi

    Jboss AS 7.1.3.Final memory consumption, possible memory leak?

    puthi

      Hi,

       

      I have been testing migrating from Jboss AS 4 to jboss AS 7.1.3.final, one thing i notice everytimes i start or stop jboss 7 not all the memory consume by the AS are release. There are 3 use cases that i tested on CentOS 5.5, OpenJDK 1.6_0_24

       

      1- Start and Stop jboss as 7 without any application deployed

      JVM config:    -Xms1536m -Xmx1536m -XX:MaxPermSize=512m

       

      Start_Mem
      Mem_JBOSS_RUNNINGMem_JBOSS_STOP
      1139608k
      ==> 1372000k=> 1140352k
      1141428k
      ==> 1360452k=> 1140836k
      1140828k
      ==> 1374012k=> 1141632k
      1141632k
      ==> 1368068k=> 1140772k

       

      After 4 restarts, 1164k of memory are different, not a big problem.

       

      2- Start and Stop jboss as 7 with my application deployed (2 EARs with 9 WARs inside)

      JVM config:    -Xms1536m -Xmx1536m -XX:MaxPermSize=512m

       

      Start_Mem
      Mem_JBOSS_RUNNING
      Mem_JBOSS_STOP
      466204k
      ==> 3950508k
      => 709176k
      709176k
      ==> 3952528k
      => 736212K
      736212k
      ==> 3968480k
      => 738620k
      738620k
      ==> 3974768k
      => 748708k

       

      after 4 restarts, 282504k amount of memory different, and almost 20000k different every restart.

      Please note that to start up my application, it will need to use at least 1GB of heap size and 386MB of Permsize.

       

      3- Start Jboss and keep deploy + undeploy my application without restarting jboss

      JVM config:    -Xms1536m -Xmx1536m -XX:MaxPermSize=512m

       

       

      Mem_jboss
      Mem_app_deployedMem_app_undeployed
      1901368k
      ==> 2739556k=> 2393420k
      2393404k
      ==>=> 2833092k
      2833092k
      ==> 3362488k=> 2983520k

       

      Please note that to start up my application, it will need to use at least 1GB of heap size and 386MB of Permsize.

      After 3 times restart, the PermSize got maxed out (java.lang.OutOfMemoryError: PermGen space) and I'll need to restart to reclaim the memory.

       

      I've tested on Jboss AS 7.1.1 and Jboss EAP 6.1.0.Final, the same behavior occurs. And i've doubled check on jboss as 4.2.3.GA, but it doesn't behave like jboss as 7.

       

      My question is: is this a sign of memory leak? or is it normal behavior of jboss as 7?

      Is there anyway i can claim the memory back without restart my server?

       

      if you need any information from me, please let me know.

        • 1. Re: Jboss AS 7.1.3.Final memory consumption, possible memory leak?
          wdfink

          Hello Puthi,

          welcome to the forum.

           

          It is not clear to me what you mean by the given tables, what you mean by Start_Mem Mem_JB_RUNNING and MEM_JB_STOP?

          Did you mean the OS memory consumption?

           

          If you deploy/undeploy applications you can not be sure whether the JVM free the memory. Maybe force GC with the JVM console might help, but you can not be 100% sure whether the consumption is correct.

           

          If the PermGen is complete used after a couple of restarts it look like that your application keep some references and classes are not correct unloaded.

          You need to investigate a bit more. Maybe a heapdump will help you can use a Profiler (i.e. jProfier or jMat) and check what classes keept in the memory to have an idea what the root cause can be.

          1 of 1 people found this helpful
          • 2. Re: Jboss AS 7.1.3.Final memory consumption, possible memory leak?
            puthi

            Hi,

            Thanks for responding

             

            It is not clear to me what you mean by the given tables, what you mean by Start_Mem Mem_JB_RUNNING and MEM_JB_STOP?

            Did you mean the OS memory consumption?

            A:  The memory in the tables are the OS Memory.

                 for the 1st and 2nd test:  

                 Start_Mem: is the OS memory i note before starting to test, and JB is not running

                 Mem_JB_Running: is the OS memory I note during the JB is running

                 Mem_JB_Stop: is the OS memory I note after I stop JB

               

                 For the third test

                 Mem_jboss: is the OS memory when jboss start without any application deployed

                 Mem_app_deployed: is the OS memory after i deploy my application.

                 Mem_app_undeployed: is the OS memory after i undeployed my application.

             

             

            If the PermGen is complete used after a couple of restarts it look like that your application keep some references and classes are not correct unloaded.

            You need to investigate a bit more. Maybe a heapdump will help you can use a Profiler (i.e. jProfier or jMat) and check what classes keept in the memory to have an idea what the root cause can be.

            A: the PermGen fill up only if i keep deploying and redeploying without restarting JB, but if i restart JB the PermGen get reset as well.

             

            With the above JVM setting, if I keep restarting JB, the RAM on my server will be used up and the OS's swap will be used little by little.

             

            I'll try the tool you suggest and let you know the result after that.

             

            Let me know if you need anything else.

            Thanks