jmeterheap-size

what is the best way to change Heap size of Jmeter which gives :OutOfMemoryError


I am trying to change the size of my jmeter(version 4) heap size from set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m to more as i have system with 64bit, 16GB RAM but unable to change it.

i have tried a lot but nothing works for me.

can any one here help me out with this issues.

Thanks in Advance!!


Solution

  • JMeter version 4 comes with 1 GB of HEAP allocated by default, you can amend it like:

    set HEAP=-Xms1G -Xmx10G && jmeter.bat
    

    You can also locate the following line in jmeter.bat file:

    set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m
    

    and amend this -Xmx1g according to your requirements. Don't allocate too much heap as it might get things worse, don't set too low as your test will be slowed down by the garbage collection. You can check heap state and other VM metrics using i.e. JVisualVM tool

    More information: