2

I am running jMeter from the command line on a Mac. Today it threw an Out of memory, heap space error....

newbie$ sh jmeter.sh
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:41)
at java.awt.image.Raster.createPackedRaster(Raster.java:455)

I know I need to increase the memory allocated to it, but not sure how. I looked at this post Unable to increase heap size for JMeter on Mac OSX and found that jMeter script file in the bin folder it mentions and made the below updates..

HEAP="-Xms1024m -Xmx2048m"
NEW="-XX:NewSize=512m -XX:MaxNewSize=1024m"

But I am still getting the out of memory error. Do I just need to give it more or am I changing in the wrong place? Could it be I need to restart my whole machine?

Community
  • 1
  • 1
AbuMariam
  • 3,282
  • 13
  • 49
  • 82
  • Two things , depending the amount of work done on the heap , 2GB max may be not sufficient. The other is , you can verify if the size is set in the JMeter.log file – Abhiram mishra Dec 08 '15 at 16:09
  • @TheNeoNoirDeveloper, I looked in jmeter.log found in the bin folder but didn't see anywhere the current memory allocation settings. – AbuMariam Dec 08 '15 at 16:29
  • Hmm, @user3223841 , then one easiest option is you would have jvisualvm , execute it ( ships with jdk already) and run your jmeter , you can find it on the left pane of visualvm, and there you can get all the details. Let me know so that I can make this as answer. If you are unaware of jvisualvm hope http://stackoverflow.com/questions/13312229/where-did-jvisualvm-go would help – Abhiram mishra Dec 08 '15 at 16:33

3 Answers3

7

As far as I understand:

  • You made changes to jmeter script
  • You're launching jmeter.sh script
  • You want to know why the changes are not applied?

If you changed jmeter script why don't you just launch it as ./jmeter ?

If you need to start JMeter via jmeter.sh for any reason, run it as follows:

JVM_ARGS="-Xms1024m -Xmx2048m -XX:NewSize=512m -XX:MaxNewSize=1024m"  && export JVM_ARGS && ./jmeter.sh

See Running JMeter User Manual chapter in particular and The Ultimate JMeter Resource List in general for the relevant documentation.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
2

If you have trouble finding it in the logs, then You can use

ps -ef | grep jmeter

this may give you the details( Not a mac user, but I thing ps -ef would work)

The other option is to use jvisualvm, it ships already with jdk, so no extra tool is required.Run the visualvm and the jmeter, you can guess the name of the application ( entry of jemter ) on the left pane of visualvm , click on it, and all the jvm details will be available.

After this you can confirm whether jmeter is availed with 2GB max Ram. And increase if needed.

Community
  • 1
  • 1
Abhiram mishra
  • 1,597
  • 2
  • 14
  • 34
0

There could be different possible reasons for OutOfMemory Error. If you have successfully changed the allocated memory/heap size and still getting the issue then you can look into following factors:

Listeners: Do not use 'TreeView' and 'TableView' Listeners in actual load test as they consume lot of memory. Best practice is to save results in .JTL file, which can be later used for getting different reports.

Non-GUI Mode: Do not use GUI mode while performing actual load test. Run test from command line.

For more, visit the following blog as it has some really nice tips to solve OutOfMemory issues in JMeter.

http://www.testingdiaries.com/jmeter-out-of-memory-error/

TestingWithArif
  • 894
  • 2
  • 13
  • 19