1

I have a legacy project that is built using some complex ant scripts. Basically it boils down to a central ant script that declares a filelist of project build files, then for each target that is run it iterates over the list of build files and uses subant to call the target for that project, e.g.

<subant target="targetName">
    <filelist refid="projectList"/>
</subant>

One of the targets that I call is for Sonar, and the Sonar target looks like:

<target name="sonar" depends="sonar-init, jacoco-report" if="${sonar.enabled}">
    <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml" classpathref="sonar.classpath"/>
    <sonar:sonar/>
</target>

I have done some analysis using jconsole and I can see that every time we launch the sonar task, around about the time it installs the JDBC driver (based on sonar's logging) the PermGen usage jumps about 30MB. Since we have some builds that include a large number of projects this can result in PermGen usage jumping very high, and I have to increase the MaxPermSize to get the full build to complete.

Is there any way I can get either Sonar or Ant to not load everything into memory every time the Sonar task is called?

DaveJohnston
  • 10,031
  • 10
  • 54
  • 83
  • Similar problem here: http://stackoverflow.com/questions/13175668/sonar-java-lang-outofmemoryerror-permgen-space (Though it doesn't address the why, just the how.) Unless you want to take the time and effort to profile the ant VM while it is inside this task, you might have to live with bumping resources. –  Mar 03 '15 at 18:04
  • 1
    Unfortunately my only answer is that db connections, and so the JDBC driver and its memory leak, will be dropped from analysis in version 5.2. It was solved this issue. – Simon Brandhof Mar 04 '15 at 20:39
  • @SimonBrandhof Do you have any idea how far out version 5.2 is? – DaveJohnston Mar 05 '15 at 15:20
  • 1
    no planned date, but I would say in three months. – Simon Brandhof Mar 06 '15 at 16:12

0 Answers0