I am facing below OutOfMemor errors, and JMeter stops working....
java.lang.OutOfMemoryError: Java heap space Dumping heap to
java_pid4412.hprof ... Heap
You should check whether you're not using a tree result listener during your tests with many users.
Check jmeter best practices to avoid this kind of issues.
Regards
A lot of these answers are out-of-date. Currently using jmeter v5.1.1 r1855137:
# Set var to increase available memory
JVM_ARGS="-Xms2048m -Xmx4096m"
# Run jmeter via sh script, e.g.:
/jmeter/5.1.1/libexec/bin/jmeter.sh -n -t testfile.jmx -l results.jtl -j log.txt
You can verify that the increase in memory is available via the log.txt file, which will show the following using the values above:
INFO o.a.j.JMeter: Max memory =3817865216
Adjust the heap size as mentioned in the other answers and also take some best practices into account
These 2 items will already greatly increase your performance and heap size usage
How much memory have you allocated for the JVM? Somewhere aroung 512 MB?
The configuration is
java -Xms<initial heap size> -Xmx<maximum heap size>
Your Heap dump shows that you are using default JMeter settings of 512 Mo. so even if you have 16gb you are not using them.
Replace default JVM optional in jmeter.bat to the right size:
set HEAP=-server -Xms768m -Xmx768m -Xss128k
set NEW=-XX:NewSize=1024m -XX:MaxNewSize=1024m
Also look at:
http://wiki.apache.org/jmeter/JMeterFAQ#JMeter_keeps_getting_.22Out_of_Memory.22_errors.__What_can_I_do.3F
http://www.ubik-ingenierie.com/blog/jmeter_performance_tuning_tips/