1 Reply Latest reply on May 2, 2007 9:28 PM by Peter Johnson

    poor use of Memory

    Isaac Aboytes Newbie

      I have started my jboss with the options java -Xms1024m -Xmx2560m
      but it seems that jboss is not using all the amount of memory the server
      has allocated for it, the higest percentage of memory it uses is 24%.

      I have a class that only creates blocks of memory, I use it to taste
      that JMV can use the 2560m it has available and when I run it, it takes
      the total memory it can.

      I don't know if a parameter in jbosss controls the amount of memory
      it can use, apart of the well known java -Xms1024m -Xmx2560m

      SO: Fedora 3
      JBOSS: 4.0.2
      JVM: jdk1.5.0_06

        • 1. Re: poor use of Memory
          Peter Johnson Master

          A Java application will take only as much memory as it needs for the objects it has created. Given your heap settings, the JVM will initially reserve 1024MB of memory (in Windows it shows up as "committed" memory) thought the OS is typically a little smarter and only allocates the actual amount of physical memory required by the allocated objects. For example, the app might need only 200MB, in which case that amount of physical memory is allocated while the other 824MB stays in reserve and is physically allocated only when required.

          If you put a pause at the start if your memory-eating app, you will notice that it also initially only uses a very small amount of memory. If you put a pause between iterations of your loop you will see them emory gradually increase.

          The app server does lazy-loading for deployed applications and services. As the app server runs and handles requests, you will see the memory usage increase. If you want to pre-allocate that memory, you could create a service that initializes various apps by doing things such as establishing database connections, allocating EJBs, etc.