Reputation: 999
When try to run jMeter with 50 or more user it gives OutOfMemoryError:
2013/12/18 13:35:15 ERROR - jmeter.threads.JMeterThread: Error processing Assertion java.lang.OutOfMemoryError: Java heap space
2013/12/18 13:35:15 ERROR - jmeter.threads.JMeterThread: Error processing Assertion java.lang.OutOfMemoryError: Java heap space
2013/12/18 13:35:15 ERROR - jmeter.threads.JMeterThread: Error processing Assertion java.lang.OutOfMemoryError: Java heap space
2013/12/18 13:35:15 ERROR - jmeter.threads.JMeterThread: Error processing Assertion java.lang.OutOfMemoryError: Java heap space
2013/12/18 13:35:16 ERROR - jmeter.threads.JMeterThread: Test failed! java.lang.OutOfMemoryError: Java heap space
2013/12/18 13:35:17 ERROR - jmeter.threads.JMeterThread: Test failed!
I tried to increase the heap size but still getting the same error.
Even i tried to remove all the listeners but nothing changed.
Upvotes: 20
Views: 73548
Reputation: 872
To set a higher JVM heap space, find your jmeter script (/usr/share/jmeter/bin/jmeter on Ubuntu when jmeter
was installed through apt) and add the following line (found on https://www.blazemeter.com/blog/9-easy-solutions-jmeter-load-test-%e2%80%9cout-memory%e2%80%9d-failure/) before the run_java line:
HEAP="-Xms512m -Xmx4g"
Here the maximum heap space was increased to 4GB.
However you might still run out of memory. This can happen when you run a lot of samples and you have a listener which collects data for each sample (for example Listener -> View Results in Tree). Remove this kind of (result) listener and focus on summarized result listeners (e.g. Listener -> Summary Report). This uses much less heap space, even for large stress tests.
Upvotes: 0
Reputation: 227
My one liner for this on a Mac (jmeter is bash script in this case):
$ JVM_ARGS="-Xms4g -Xmx4g -XX:NewSize=4g -XX:MaxNewSize=4g" && export JVM_ARGS && jmeter
Upvotes: 0
Reputation: 2370
in the Jmeter 3.x. there are two steps to solve this problem.
Step 1, to modify the JVM memory in the JMeter batch file
## ==============================================
## Environment variables:
## JVM_ARGS - optional java args, e.g. -Dprop=val
##
## e.g.
## JVM_ARGS="-Xms512m -Xmx512m" jmeter etc.
##
## ==============================================
this is a default value in the jmeter.sh, according to your environment:
JVM_ARGS="-Xms512m -Xmx2048m"
in the jmeter.bat:
set JVM_ARGS=-Xms512m -Xmx2048m
Step 2, to Modify HEAP="-Xms512m -Xmx512m" in the JMeter batch file:
in the jmeter.sh
HEAP="-Xms512m -Xmx2048m"
in the jmeter.bat:
set HEAP=-Xms512m -Xmx2048m
Upvotes: 3
Reputation: 637
There can be many reasons why JMeter is consuming a lot of memory:
Tweaking the Heap is just one way to fix those issues:
JVM_ARGS="-Xms512m -Xmx512m" jmeter.sh
Check out JMeter Out Of Memory: 12 Ways to Fix Them for even more valuable tips.
Upvotes: 0
Reputation: 499
Open bin/jmeter.bat on windows or bin/jmeter.sh on linux, find this line:
set HEAP=-Xms512m -Xmx512m
This variable is passed as arguments to jmeter at startup. Increase the default heapsize like this:
set HEAP=-Xms1024m -Xmx1024m
You could add more space if you have available and if jmeter needs more. Hope that helps.
Upvotes: 2
Reputation: 323
After the increase, the heap size in bat file remove all listener from the test plan, Then run your script and see the magic.Now you won't get out of memory error in jmeter Enjoy!
Upvotes: 10
Reputation: 168002
It looks like that you're just lacking Java Heap Space. It's normal as JMeter by default has a very low heap allocation. It's controllable via -Xmx
parameter.
There is a line in jmeter.bat
or jmeter.sh
script which recommends launching JMeter as
JVM_ARGS="-Xms512m -Xmx512m" jmeter.sh
You can try increasing maximum heap until you'll stop receiving these errors. I'd recommend to set it to something like 80% of your hardware RAM.
Also consider JMeter Performance and Tuning Tips article to make sure that you disable memory-consuming listeners, don't overscript, use post-processors efficiently, etc.
Upvotes: 42