title: Sonar analysis gives out of memory error, should I increase JVM heap space of Ant or Sonar server?
body: <p>I am analysing a large project in Sonar and get the following error:</p>
  
  <pre><code>[sonar:sonar] 03:55:39.511 INFO  p.PhasesTimeProfiler - Execute decorators...
  
  BUILD FAILED
  [...]
  [...] java.lang.OutOfMemoryError: Java heap space
  at org.sonar.batch.index.MeasurePersister.model(MeasurePersister.java:127)
  at org.sonar.batch.index.MeasurePersister.getMeasuresToSave(MeasurePersister.java:117)
  at org.sonar.batch.index.MeasurePersister.dump(MeasurePersister.java:70)
  at org.sonar.batch.index.DefaultPersistenceManager.dump(DefaultPersistenceManager.java:63)
  at org.sonar.batch.phases.Phases.execute(Phases.java:95)
  at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:139)
  at org.sonar.batch.bootstrap.Module.start(Module.java:83)
  at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:131)
  at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:121)
  at org.sonar.batch.bootstrap.Module.start(Module.java:83)
  at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:121)
  at org.sonar.batch.bootstrap.Module.start(Module.java:83)
  at org.sonar.batch.Batch.execute(Batch.java:104)
  at org.sonar.ant.Launcher.execute(Launcher.java:78)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:616)
  at org.sonar.ant.SonarTask.delegateExecution(SonarTask.java:244)
  at org.sonar.ant.SonarTask.execute(SonarTask.java:193)
  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
  at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:616)
  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
  at org.apache.tools.ant.Task.perform(Task.java:348)
  at org.apache.tools.ant.Target.execute(Target.java:392)
  at org.apache.tools.ant.Target.performTasks(Target.java:413)
  at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
  at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
  at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
  at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
  </code></pre>
  
  <p>Should I increase the java heap space of the running Sonar server, or the Ant target executing the Sonar job?</p>