# OutOfMemoryError PermGen space when running Sonar Runner

**URL:** <https://discuss.gradle.org/t/outofmemoryerror-permgen-space-when-running-sonar-runner/5760>\
**Category:** Old Forum Archive\
**Created:** [April 9, 2014, 9:45am UTC](https://discuss.gradle.org/t/outofmemoryerror-permgen-space-when-running-sonar-runner/5760 "2014-04-09T09:45:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pau\_Paches](https://avatars.discourse-cdn.com/v4/letter/p/c4cdca/32.png) [@Pau\_Paches](https://discuss.gradle.org/u/Pau_Paches)\
**Post date:** [April 9, 2014, 9:45am UTC](https://discuss.gradle.org/t/outofmemoryerror-permgen-space-when-running-sonar-runner/5760/1 "2014-04-09T09:45:00Z")

</div>

I get an error when applying the Sonar Runner plugin in Gradle. Error message is OutOfMemoryError: PermGen space, apparently running PMD. How we can specify -XX:MaxPermSize=512M to the PMD process that’s ultimately started by SonarRunner. I’m using Java 6 due to project internal needs Another error I’m seeing: \> java.lang.VerifyError: (class: org/picocontainer/PicoLifecycleException, method: getMessage signature: ()Ljava/lang/String; ) Illegal constant pool index

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [April 9, 2014, 10:29am UTC](https://discuss.gradle.org/t/outofmemoryerror-permgen-space-when-running-sonar-runner/5760/2 "2014-04-09T10:29:00Z")

</div>

Currently, the Sonar Runner gets executed inside the Gradle JVM. (This will likely change in the future.) The best way to control memory settings for the Gradle JVM is via ‘org.gradle.jvmargs=…’ in ‘gradle.properties’.

---

<div class="post-metadata">

**Author:** ![Pau\_Paches](https://avatars.discourse-cdn.com/v4/letter/p/c4cdca/32.png) [@Pau\_Paches](https://discuss.gradle.org/u/Pau_Paches)\
**Post date:** [April 9, 2014, 10:45am UTC](https://discuss.gradle.org/t/outofmemoryerror-permgen-space-when-running-sonar-runner/5760/3 "2014-04-09T10:45:00Z")

</div>

Using what you suggest with the right hand side -XX:MaxPermSize=512M makes “gradle sonarRunner” run to completion. Thanks.

---

<div class="post-metadata">

**Author:** ![steveb](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@steveb](https://discuss.gradle.org/u/steveb)\
**Post date:** [April 9, 2014, 12:56pm UTC](https://discuss.gradle.org/t/outofmemoryerror-permgen-space-when-running-sonar-runner/5760/4 "2014-04-09T12:56:00Z")

</div>

We use sonarRunner with a 64bit JVM (Win7 64bit) and the settings below (don’t remember where I got those from).

```gradle
-server
-Xmx16G -Xms4G
-XX:ReservedCodeCacheSize=2G
-XX:+DisableExplicitGC
-XX:MaxPermSize=2G
-XX:PermSize=1G
-XX:MaxNewSize=2G
-XX:NewSize=1G
-XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled
-XX:+CMSPermGenSweepingEnabled

```
