The memory problem is solved after increasing the memory of the docker and of the Bitbucket pipeline step by adding Xmx2048m option:
script:
- pipe: sonarsource/sonarcloud-scan:1.4.0
variables:
SONAR_SCANNER_OPTS: -Xmx2048m