title: OutOfMemoryError: PermGen space when starting an embedded Tomcat
body: <p>I have a library (<a href="https://github.com/lucasmedeirosleite/vraptor-test" rel="nofollow">vraptor-test</a>) that does unit testing at my webservices in my maven project. In onder to run these tests, this library starts an embedded Tomcat.</p>
  
  <p><code>Tomcat tomcat = new Tomcat();</code></p>
  
  <p>I have checked the dependency tree, and the list below representss tomcat related jars added to my project by the test library:</p>
  
  <pre><code>+- org.apache.tomcat:tomcat-catalina:jar:7.0.23:compile
  [INFO] |  |  +- org.apache.tomcat:tomcat-servlet-api:jar:7.0.23:compile
  [INFO] |  |  +- org.apache.tomcat:tomcat-juli:jar:7.0.23:compile
  [INFO] |  |  +- org.apache.tomcat:tomcat-annotations-api:jar:7.0.23:compile
  [INFO] |  |  +- org.apache.tomcat:tomcat-api:jar:7.0.23:compile
  [INFO] |  |  \- org.apache.tomcat:tomcat-util:jar:7.0.23:compile
  [INFO] |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:7.0.23:compile
  [INFO] |  \- org.apache.tomcat:tomcat-jasper:jar:7.0.23:compile
  [INFO] |     +- org.apache.tomcat:tomcat-jsp-api:jar:7.0.23:compile
  [INFO] |     +- org.apache.tomcat:tomcat-el-api:jar:7.0.23:compile
  [INFO] |     +- org.eclipse.jdt.core.compiler:ecj:jar:3.7:compile
  [INFO] |     \- org.apache.tomcat:tomcat-jasper-el:jar:7.0.23:compile
  </code></pre>
  
  <p>When I run my test classes the error below pops up and the test doesn't even complete:</p>
  
  <pre><code>SEVERE: A child container failed during start
  java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: PermGen space
  </code></pre>
  
  <p>Usually, I would make changes to <code>setenv.bat</code> under tomcat folder to increase the PermGem space, but, since I'm running an embedded Tomcat, I can't find its folder, only its jars.</p>
  
  <p>I've tried increasing JVM memory in Eclipse (Window -> Preferences -> Java -> Installed JREs -> jdk -> Edit -> Default Vm Arguments) to <code>-Xmx1024M -Xms1024M -XX:PermSize=2048m -XX:MaxPermSize=2048m</code> but I'm still getting the same error.</p>
  
  <p>Where can I change permgem space of my embedded tomcat?</p>