Sonarqube causing Out Of Memory on jenkins pipeline

when we integrate sonar in jenkins pipeline with
withSonarQubeEnv(‘SonarQube’) it causes Out Of Memory issue and when we try with
withSonarQubeEnv(installationName: ‘SonarQube’, envOnly: true)
the pipeline completes without any issue.
how does the envOnly:true solves the issue on jenkins?

we also tried to integrate sonar in pipeline with
withSonarQubeEnv(‘SonarQube’) with increased memory on jenkins in that case the pipeline gets completed without any issue.