Free Memory

Posted on 2011-04-28
Last Modified: 2012-05-11
Hi Guys,

We're using JMeter to load test our web based Java application, deployed in Linux server, web server : apache tomcat.

We run it for 25 concurrent users. And the memory spike into 2GB.

Then we stop the test on JMeter, but the memory is still on 2Gb,

Can u suggest solution so the memory is getting back to less than 2Gb? Or we just need to to wait?
Question by:softbless
    LVL 92

    Expert Comment

    As I mentioned in your other question it won't.
    What you're looking at is the memory allocated to the application by the OS
    It will be given more when needed but it won't be released.

    Its also not directly related to the amount of memory actually used by your application.
    LVL 3

    Accepted Solution

    Memory will not clear easily because of Java Garbage and Cache :

    Try to concentrate on three Java Application Values :


    And :( that is kind of fix )

    asynchronous calls to be processed synchronously, instead of many asynchronous calls waiting for some lock to be released on a synchronous

    For Above two matter you need to talk with your Dev Team also.
    LVL 92

    Assisted Solution

    What you want to do is make Xms the same as Xmx. that'll stop it adding more memory when required which is only going to use up resources.
    LVL 92

    Expert Comment

    But your main problem is that you're not measuring the memory *usage* of the *application*.
    you're measuring the memory *allocated* to the *vm*
    LVL 4

    Assisted Solution

    trying invoking System.gc() through any of your APIs after stopping JMeter.
    LVL 26

    Assisted Solution

    It may help you to read up on the docs for how Java describes its own memory.

    From code you can do this to examine the current memory usage:

                MemoryMXBean mbean = ManagementFactory.getMemoryMXBean();
                MemoryUsage usage = mbean.getHeapMemoryUsage() ;
                double committed = usage.getCommitted() ;
                double init = usage.getInit() ;
                double used = usage.getUsed() ;
                double free = committed - used ;
                double max = usage.getMax() ;

    The docs for what those specific values mean are explained here:

    I think you're currently confusing "Committed" with "Used".


    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
    Configure Web Service (server application) I. Configure security for Web Services methods First, we need to protect Session bean which implements the service: 1. Open EJB deployment descriptor (ejb-jar.xml) in the EJB project that contains you…
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
    This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now