SonarQube Cloud still uses the same analysis engine as SonarQube, so I don’t expect that migrating to it would solve this issue.
Typically the latest issue you’ve referenced is solved by bumping up the memory available to the pipeline (see here and here).