Fix 'could not reserve enough space for 2097152KB object heap' JFrog Artifactory startup error

You’ve decided to set up a Maven repository, and you’ve settled on JFrog Artifactory as your artifact life-cycle management tool, but every time you try to run the product you’re getting a could not reserve enough space for 2097152KB object heap startup error message. Don’t fret. There’s an easy fix.

JFrog Artifactory 2097152KB startup error

JFrog Artifactory 2097152KB object heap startup error

In the \bin directory of your JFrog Artifactory installation, there’s a file named arifactory.bat which contains a number of settings. The offending one is JAVA_OPTIONS which sets the -Xmx flag to two gigs, or as the Artifactory startup error more accurately states, to a 2097152KB object heap. To fix the could not reserve enough space for 2097152KB object heap error message, just change the -Xmx setting to something more conservative such as 512m or 1024m.

Before fixing the Artifactory object heap error:

set JAVA_OPTIONS=-server -Xms512m -Xmx2g -Xss256k -XX:+UseG1GC

After fixing the Artifactory object heap error:

set JAVA_OPTIONS=-server -Xms512m -Xmx1024m -Xss256k -XX:+UseG1GC

Artifactory Xmx setting

Change the Artifactory Xmx setting to 512m instead of 2g

Obviously the artifactory.bat file is for windows installations. There is an artifactory.sh file to edit if you are running the JFrog Maven repository on a Linux distribution.

Production Artifactory Maven repos

It should also be noted that the default JFrog Artifactory JAVA_OPTIONS set Xmx to 2g because the people who build the product believe that is a good starting point for production based systems. On a production machine, a better approach to fixing the could not reserve enough space for 2097152KB object heap startup error is to actually allocate more memory to the Docker container or the virtual machine. But for test environments or for people who just want to learn Maven, along with how an artifact based DevOps tool works, this quick fix should be more than sufficient.

JFrog Artifactory startup error fix

Putting out fires on JFrog Artifactory startup.

App Architecture
Software Quality
Cloud Computing
Security
SearchAWS
Close