Java heap space Error (java.lang.OutOfMemoryError: Java heap space)


we’re using:

  • SonarQube Version
  • SonarScanner

We’ve tried to set the environment variable as follows:
export SONAR_SCANNER_OPTS="-Xmx4096m"

During a scan from a MacOS machine we encounter this error:

We have used the following command:

sonar-scanner -X > sonarCdo.log

so we have a full debug file, but we’d prefer to share it privately if necessary.
List of plugins follows below.

Thanks for your attention. We’re looking forward to your reply.

All the best,


SonarCSS (cssfamily)
Svn (scmsvn)
SonarPLSQL (plsql)
SonarScala (sonarscala)
SonarC# (csharp)
Vulnerability Analysis (security)
SonarJava (java)
SonarHTML (web)
SonarFlex (flex)
SonarXML (xml)
SonarTS (typescript)
SonarVB (vbnet)
SonarSwift (swift)
SonarCFamily (cpp)
SonarPython (python)
JaCoCo (jacoco)
SonarGo (go)
SonarKotlin (kotlin)
SonarTSQL (tsql)
SonarJS (javascript)
SonarRuby (ruby)
Vulnerability Rules for C# (securitycsharpfrontend)
Vulnerability Rules for Java (securityjavafrontend)
License for SonarLint 8.0 (license)
Git (scmgit)
SonarPHP (php)
SonarABAP (abap)
Vulnerability Rules for PHP (securityphpfrontend)

Hi Luigi,

SonarQube 8.0 is over a year old and quite outdated. We’d recommend you consider an update to the latest version (currently 8.7) as soon as possible.

If your logged output indicates the value of SONAR_SCANNER_OPTS is being used, perhaps you just didn’t set it high enough. 4096M is merely an example value in our docs; you might need to adjust higher depending upon the needs of the project. If you have the available memory, pump it up!

Hi Jeff,
is there a recommended upgrade path from 8.0 to 8.7 version that contemplates intermediate versions or we can go directly from 8.0 to 8.7?
Is there a spreadsheet version of the following matrix?
Plugin Version Matrix | SonarQube Docs
thanks in advance,
All the best,