Sonarqube taking massive amounts of memory
Please refer to the following article on the SonarQube - SonarScanner setup best practices. It will be good if the following hardware recommendations  are considered for the SonarQube installations. Following are some of the important considerations.

SonarQube server should be on a real DB not on H2.
The analysis should occur very close to the SonarQube DB.