SonarQube 10.4 gradleplugin scan failing with jave heap space issue

We are using sonarqube verion 10.4(enterprise sonar) deployed via zip . We facing an issue with the analysis of one our projects . While it is absolute working fine on our another instance which is 10.0 (developer edition).
On the 10.4 version , the project analysis never done and it says java heap space is out of space.
We tried with giving 22g as well but stilll it runs for forme than 8 hours and then fails with the error

  • Out of memory: Java heap space (This problem is reported because OutOfMemoryError has been found in the build log text); gradle

We are using java 17 in both the cases for project .

log.txt (63.7 KB)

Additional inofrmation:

gradle_Opts
-DuseRepo=false
-Dsonar.scm.disabled=true
-Dsonar.token=****
-Dsonar.projectName=****
-Dsonar.projectKey=*****
-Dsonar.host.url=%sonar.host.url%
-Dsonar.branch.name=%BRANCH_NAME%
-Dorg.gradle.daemon=false
–stacktrace
fro increasing ram we are using :
JVM_OPTS
-Xmx22G
Sonar Gradel plugin : 4.4.1.3373

Hi Team,
Any help will be appreciated.