java.lang.OutOfMemoryError: Requested array size exceeds VM limit

Hi. I’m using SonarQube 8.9.1 Community version. The scanner which i am using is 4.3. Initially, my jenkins build was failing due to a heap size error, which i added the “sonar_runner_opts” environment variable. Once i added this, I began to see a new error which I am not familiar with:

java.lang.OutOfMemoryError: Requested array size exceeds VM limit

I did notice in both cases the error happened while trying to scan a certain xml file, which i see the following warning for:

WARN: Invalid character encountered in file [xml file] at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property ‘sonar.sourceEncoding’.

Not sure if this is related. Any suggestions would be appreciated. Thanks!

Hi @nchoudhu,

Please attach the full logs if possible so that we can have a look. By the way, you should set up
SONAR_SCANNER_OPTS instead of sonar_runner_opts, non?

Best regards,

Hi @nchoudhu,
You can first confirm that it’s only an XML analysis problem by running the scanner with:


Then you could try to only exclude the file that causes the OutOfMemoryError, and if you are able to isolate it, it would help if you send us this file (or a similar reproducer file).