Java.lang.OutofMemoryError : Java heap space, during SonarQube execution for C++

Increasing heap space via SONAR_SCANNER_OPTS does not seem to help for me.

Here is my environment:

17:11:30.835 INFO: Scanner configuration file: /opt/dcc/dcarson/sonar-scanner-4.5.0.2216-linux/conf/sonar-scanner.properties
17:11:30.837 INFO: Project root configuration file: NONE
17:11:30.851 INFO: SonarScanner 4.5.0.2216
17:11:30.851 INFO: Java 11.0.3 AdoptOpenJDK (64-bit)
17:11:30.851 INFO: Linux 3.10.0-1127.19.1.el7.x86_64 amd64
17:11:30.851 INFO: SONAR_SCANNER_OPTS=-Xmx4196m

  • running sonar-scanner from a Linux command line (bash)
  • executing ‘export SONAR_SCANNER_OPTS=-Xmx512m’ from command line to insert into environment, then running sonar-scanner (not setting this value in a config file)
  • I’ve tried as high as 4196m (i.e., 4GB) and still get the OutOfMemoryError: Java heap space

This is a trial key test to see if the product could replace our current static analysis tool. I am analyzing all C/C++ files in my checked-out clone. According to the log, my file filter is finding about 33K files based on my inclusion pattern.

Every attempt with a larger heap gives the same error.

Hi @David_Carson,

would you be able to share the entire output log? If you cannot do it here I can send you a PM where you can share privately.

Do you want a log including debug (with -X set)? That is quite large. If not, I’ll see if I can post the non-debug log. It may contain proprietary info in which case I’ll probably want to post it privately.

Hi @David_Carson,

I sent you a PM.