How to fix : JMeter Load Test “Out of Memory” Failure, Increase Heap Size in Jmeter?

How to : Increase Heap Size in Jmeter Tutorial
Quite often we are unable to perform Load/ Stress/ Performance tests on local machines due to lack of memory size.
We get errors like: JMeter Load Test “Out of Memory” Failure.

A simple hack can help us resolve this. How to increase Heap Size in Jmeter?

1. Increase the heap size:

a) Navigate to JMeter installation directory. <Installation Directory>/bin
b) Locate and Open Jmeter.bat in Text Editor
c) Search for "if not defined HEAP ("
d) Replace existing function with below code:
if not defined HEAP (
    rem See the unix startup file for the rationale of the following parameters,
    rem including some tuning recommendations
   set HEAP=-Xms8192m -Xmx8192m
   set NEW=-XX:NewSize=8192m -XX:MaxNewSize=8192m

//Here the 8192m represents 8 GB of RAM to be allocated for test run

2. Now execute the .jmx file using Command Line

<InstallationDirectory>/bin> jmeter -n -t <loadTest.jmx>

Post a Comment