Hey there! any question in your mind? Ask It Now!.

Popular Categories





out of memory error in jmeter

+3 votes
4,046 views
asked in Software Testing by tester (1,550 points)
When I am running my J meter script getting this error :

 

2015/10/25 13:35:15 ERROR - jmeter.threads.JMeterThread: Error processing Assertion  java.lang.OutOfMemoryError: Java heap space
2015/10/25 13:35:15 ERROR - jmeter.threads.JMeterThread: Error processing Assertion     java.lang.OutOfMemoryError: Java heap space
2015/10/25 13:35:15 ERROR - jmeter.threads.JMeterThread: Error processing Assertion  java.lang.OutOfMemoryError: Java heap space
2015/10/25 13:35:15 ERROR - jmeter.threads.JMeterThread: Error processing Assertion  java.lang.OutOfMemoryError: Java heap space
2015/10/25 13:35:16 ERROR - jmeter.threads.JMeterThread: Test failed! java.lang.OutOfMemoryError: Java heap space
2015/10/25 13:35:17 ERROR - jmeter.threads.JMeterThread: Test failed!

When I am running script for 100 users then its happening although script is working for 2,3 users.

Please help!

2 Answers

+1 vote
answered by Himanshu Expert (5,940 points)

This error comes when your java heap space is fully occupied so now you have to increase the heap allocation for JMeter.

Its very easy , You just have to follow these 2 steps :

1. There is a file in JMeter folder called jmeter.bat or jmeter.sh which is used to run jmeter, now you have to just use a parameter while launching jmeter . also you can change this parameter by editing this file.

JVM_ARGS="-Xms512m -Xmx512m" jmeter.sh

You can change this parameter as per your RAM, here it is 512m of your ram. you should use only 80% of your ram capacity.

2. The other thing to reduce this error is your script listeners they consume a good amount of memory so remove all listeners.

 

Now try with more users you won't get this error.

commented by anonymous
Hi Himansu, plz tell me.. where I have to add this .."JVM_ARGS="-Xms512m -Xmx512m" " for windows . For 500 threads Iam getting this "out of memory" error. My System Ram size is 2GB.
commented by Himanshu Expert (5,940 points)
First of all 2 GB Ram is not recommended for 500 threads.

For windows : Path is :  
apache-jmeter-3.0/bin/

Here you will get jmeter.bat file , edit it in notepad as per your need and save it.

There are many ways to optimize JMeter for better performance. It is a complete topic in itself but for starter, I will recommend at least configuring java xms and xmx values in JMeter.bat file. By doing so, you can make sure that JMeter is properly using the available memory resources. It also reduces the chances of OutOfMemory errors.

To change these settings, open jmeter.bat file in notepad and update following lines

1
2
3
4
// default configuration
 
set HEAP=-Xms512m -Xmx512m
set NEW=-XX:NewSize=128m -XX:MaxNewSize=128m
1
2
3

// new settings could be like this *depending* on your hardware and software specs
// note that, Max heap size should not exceed the 80% of total system memory
 
set HEAP=-Xms512m -Xmx2048m
set NEW=-XX:NewSize=128m -XX:MaxNewSize=1024m

Other than this configuration, it is also important to use listeners intelligently in your test plan. Listeners that consume more memory like Table, Tree, Assertion and Graph listeners should be avoided during actual load test execution. It is best to only generate JTL test results file during actual load tests and later that JTL file can be used to create different reports.
commented by Sumit
JMeter’s default configuration (see jmeter.bat for Windows or jmeter for non-Windows systems scripts) assumes a heap space of 512 megabytes only.

To do this, find the following line in your JMeter startup script:
 
HEAP="-Xms512m -Xmx512m"
 
Now change the -Xmx value accordingly. For example: if you want to set the maximum heap size to 4 gigabytes, you’ll need to change the line to: HEAP="-Xms512m -Xmx4096m".

Hope it helps!!
0 votes
answered by Shrinath
Delete temporary files and try  10 or 20 users ,still your getting that error it's system problem, if your executing in GUI mode it take lot of memory try to execute non GUI mode with 10 or 20 concurrent users
commented by Prasana
If only jmeter is running on the machine then you can keep 2gb RAM to OS and then allocate remaining to JVM heap ,as mentioned by sumit. In your case you can allocate 6GB to jmeter jvm.

Also we can tune the jmeter itself by changing its ga parameters, and analyse the gc patterns. If jmeter process has gone out of memory there must be heap dump generated
. Hprof file . Open it using eclipse mat and see what is consuming more memory. Avoid unnecessary components from jmeter script. For heap analysis you can take help from developer if you are not aware how to do that .

Related Questions

0 votes
0 answers 147 views
+2 votes
0 answers 482 views
0 votes
1 answer 253 views

Not a Member yet?

Ask to Folks Login

My Account
206 Folks are online
0 members and 206 guest online
Your feedback is highly appreciated