Forum Discussion

Mdar's avatar
Mdar
Occasional Contributor
2 years ago
Solved

More than 95% of Java heap memory is being used warning.

Hello

 

Since the update to 3.40.0, I've been getting the following message,

 

"More than 95% of the Java heap memory is being used. The test results may be impacted. It is recommended you increase the VM option -Xmx or -XX:MaxHeapSize in the file ReadyAPI.vmoptions."

 

I have a collection of test steps that are initializing a list of pretty lightweight java objects -- I assumed in each test step, previous initializations of objects would no longer be in memory. My -Xmx value is -Xmx8000m -- I assume that's 8GB* of RAM basically? Is there a way to clear out previous object initializations between test steps, or let previous objects carry over into new test steps? Any thoughts or insights would be appreciated.

 

So far I've tried manually setting the objects to null within the java package to try to force garbage collection, and from the ReadyAPI Groovy scripts (between test cases) but that didn't make the warning go away.


I ran my program once outside of ReadyAPI to check some of the memory sizes,

 

getRuntime().totalMemory();

heapSize: 264241152

 

getRuntime().maxMemory
heapMaxSize: 4221566976

 

getRunTime().freeMemory();
heapFreeSize: 236652272

 

Best regards,

 

-Mdar

  • Hey Mdar 

     

    It all comes down to the spec of your machine, the size of the project (how many tests, teststeps and what the tests are doing), as well as what else you've got running on your machine which impacts whether you get close to your memory boundary.

     

    There's things you can do within ReadyAPI, like setting to discarding successful results, not storing the test results in history db, disabling the logging of results, tweaking your vmoptions file, running in headless mode.

     

    I actually stopped trying to run stuff like JMeter and SoapUI/ReadyAPI on I5's with anything less than 16Gigs about 5 years ago cos I kept hitting this problem.  I now run with I7 minimum 16Gigs and that seems to sort me for the most part.

     

    Have a look at the following link - it'll show you how to tweak your setup to max out your capability.  The fallback option is run in headless mode, but I find that annoying when I'm building/debugging tests.

     

    https://support.smartbear.com/readyapi/docs/testing/best-practices/memory-usage.html

     

    Cheers,

     

    Rich

     

     

  • Mdar It's a know issue introduced in 3.40.0 which generates a false error message 

    "More than 95% of the Java heap memory is being used. The test results may be impacted. It is recommended you increase the VM option -Xmx or -XX:MaxHeapSize in the file ReadyAPI.vmoptions."

     

    A quick workaround is to set your Xms option to the same value as the Xmx so in your case:

    -Xms8000m

    -Xmx8000m

    Sorry for the inconvenience, a patch version will be released shortly.

     

    Disclaimer: I'm part of the ReadyAPI team.

6 Replies

  • PaulV's avatar
    PaulV
    SmartBear Alumni (Retired)

    Mdar It's a know issue introduced in 3.40.0 which generates a false error message 

    "More than 95% of the Java heap memory is being used. The test results may be impacted. It is recommended you increase the VM option -Xmx or -XX:MaxHeapSize in the file ReadyAPI.vmoptions."

     

    A quick workaround is to set your Xms option to the same value as the Xmx so in your case:

    -Xms8000m

    -Xmx8000m

    Sorry for the inconvenience, a patch version will be released shortly.

     

    Disclaimer: I'm part of the ReadyAPI team.

    • Mdar's avatar
      Mdar
      Occasional Contributor

      Paul,

       

      Thanks for the response, that's a relief. I've never run into memory issues with my Java code before, ha!

       

      All the best,

       

      -Mdar

  • richie's avatar
    richie
    Community Hero

    Hey Mdar 

     

    It all comes down to the spec of your machine, the size of the project (how many tests, teststeps and what the tests are doing), as well as what else you've got running on your machine which impacts whether you get close to your memory boundary.

     

    There's things you can do within ReadyAPI, like setting to discarding successful results, not storing the test results in history db, disabling the logging of results, tweaking your vmoptions file, running in headless mode.

     

    I actually stopped trying to run stuff like JMeter and SoapUI/ReadyAPI on I5's with anything less than 16Gigs about 5 years ago cos I kept hitting this problem.  I now run with I7 minimum 16Gigs and that seems to sort me for the most part.

     

    Have a look at the following link - it'll show you how to tweak your setup to max out your capability.  The fallback option is run in headless mode, but I find that annoying when I'm building/debugging tests.

     

    https://support.smartbear.com/readyapi/docs/testing/best-practices/memory-usage.html

     

    Cheers,

     

    Rich

     

     

    • Mdar's avatar
      Mdar
      Occasional Contributor

      richie 

       

      Thank you for the great response, I'll study that article and see if I can reign in some of the memory.

       

      All the best

       

      -MDar

      • richie's avatar
        richie
        Community Hero

        Hey Mdar 

         

        happy to help! 🙂

         

        nice one,

         

        Rich