How to resolve SOLR Heap size issue?

We recently started facing heap size issue on one of our SOLR instance.

Error: Caused by: java.lang.OutOfMemoryError: Java heap space

I thought it was easy fix by just adding more memory but it wasn’t as forward as I thought. Before you jump to the solution I will share a good link which will explain you the cause of it in the first place.


This can be fixed by updating the memory value double of what is currently present in your SOLR instance (default is 512 MB)

  1. Go to the SOLR instance.
  2. Open file (C:\<SOLR instance>\solr-<version>\bin)
  3. Search for “SOLR_JAVA_MEM”.
  4. You will see a commented line – “REM set SOLR_JAVA_MEM=-Xms512m -Xmx512m”.
  5. Remove the REM at the beginning to uncomment it.
  6. Change the value to 1024m – “set SOLR_JAVA_MEM=-Xms1024m -Xmx1024m”
  7. Save the file and restart the service.

Tip: It wasn’t allowing me to use 1024m and the service was throwing error, I used 1000m and it worked.

If the above steps doesn’t work then you can update the values in solr.cmd file.

  1. Search for “SOLR_JAVA_MEM” in Solr.cmd file.
  2. You will see this line – “IF “%SOLR_JAVA_MEM%”==”” set SOLR_JAVA_MEM=-Xms512m -Xmx512m”
  3. Comment the line by adding REM at the beginning.
  4. Add new line line below it – “IF “set SOLR_JAVA_MEM=-Xms1024m -Xmx1024m”
  5. Save the file and restart the service.

The links that I referred while troubleshooting are:


Thank you.. Keep Learning.. Keep Sitecoring.. 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s