Java – Jmeter, how to increase heap size

Jmeter, how to increase heap size… here is a solution to the problem.

Jmeter, how to increase heap size


read that you need to change the heap size in the jmeter.bat file (I’m using Windows) to increase the memory to be able to test about 500 or more threads. This is the default value:

if not defined HEAP (
    rem See the unix startup file for the rationale of the following parameters,
    rem including some tuning recommendations
    set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m

I changed set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m to:

set HEAP=-Xms2g -Xmx8g -XX:MaxMetaspaceSize=512m

But when I open Jmeter in GUI mode, there is a message in the command line window

Modify current env variable HEAP="-Xms1g -Xmx1g -XX:MaxMetaSpaceSize=256m" in the jmeter batch file

So does this mean that the changes in the batch file don’t work? Or does it work when running in non-GUI mode? Am I missing something to change? Thanks in advance.


  1. Unless encountering java.lang.OutOfMemoryError: Java heap space error , otherwise you do not need to increase the heap. or detected an abnormally high GC activity
  2. The message is basically a form of suggestion that you will see even if you have a few terabytes of heap space simply hard-coded and will always be displayed during GUI startup. If you want to view all Java parameters, including heap space settings, you can use JSR223 Sampler and the following Groovy code: {"Effective JVM argument: " + "$it")

    This allows you to test whether your changes have been applied:

    enter image description here

Related Problems and Solutions