title: Java out of memory errors on large WSDLs (play framework)
body: <p>We've got a problem when trying to generate and use a really large proxy file (For the record, it's from a MSCRM Dynamics WSDL). Before I get to the issue: we already have this working in a stand alone app using NetBeans. We generated all the proxy files using "WSDL2Java -uri etc etc". Poked at a few of the web methods and successfully got responses etc.</p>
  
  <p>Now, when we try to integrate it into the destination project in eclipse (launched through play framework) it throws out of memory errors. This happens before I even try to make a call to any webservices. I've read about memory issues with Play Framework and Axis2, but haven't as of yet seen any solutions to the problem. I've tried upping the memory on play, but that didn't help. I'm running on windows, but even though I have a 64 bit OS can only seem to allocate 1.5gb to the play heap space:</p>
  
  <pre><code>play clean  
  play run . -Xms1536m
  </code></pre>
  
  <p>I thought this would be enough, but alas no! </p>
  
  <p>For reference the stack trace is:</p>
  
  <pre><code> An unexpected error occured caused by exception OutOfMemoryError: Java heap space
  
   play.exceptions.UnexpectedException: Unexpected Error
           at play.Invoker$Invocation.onException(Invoker.java:244)
           at play.Invoker$Invocation.run(Invoker.java:286)
           at Invocation.HTTP Request(Play!) Caused by: java.lang.OutOfMemoryError: Java heap space
           at java.util.Arrays.copyOfRange(Unknown Source)
           at java.lang.String.&lt;init&gt;(Unknown Source)
           at java.lang.StringBuffer.toString(Unknown Source)
           at java.io.StringWriter.toString(Unknown Source)
           at org.apache.commons.io.IOUtils.toString(IOUtils.java:383)
           at play.libs.IO.readContentAsString(IO.java:60)
           at play.libs.IO.readContentAsString(IO.java:49)
           at play.vfs.VirtualFile.contentAsString(VirtualFile.java:178)
           at play.classloading.ApplicationClasses$ApplicationClass.refresh(ApplicationClasses.java:199)
           at play.classloading.ApplicationClasses$ApplicationClass.&lt;init&gt;(ApplicationClasses.java:191)
           at play.classloading.ApplicationClasses.getApplicationClass(ApplicationClasses.java:49)
           at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:266)
           at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:478)
           at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:282)
           at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:424)
           at play.Play.start(Play.java:505)
           at play.Play.detectChanges(Play.java:618)
           at play.Invoker$Invocation.init(Invoker.java:198)
           ... 1 more
  </code></pre>
  
  <p>Any help or thoughts would be greatly appreciated!</p>
  
  <hr>
  
  <p><strong>Update 1</strong></p>
  
  <p>Following advice from FloppyDisk I've checked / changed the following to see if it helps:</p>
  
  <p>Firstly, using the post <a href="https://stackoverflow.com/questions/2062020/how-can-i-tell-if-im-running-in-64-bit-jvm-or-32-bit-jvm">How can I tell if I&#39;m running in 64-bit JVM or 32-bit JVM (from within a program)?</a>, I ran the following to ensure I'm running 64 bit jdk:</p>
  
  <pre><code>java -d64 -version
  </code></pre>
  
  <p>Which didn't throw any errors. Next I tried changing my memory settings in eclipse to the following:</p>
  
  <pre><code>-vmargs
  -Xms512m
  -Xmx1024m
  -XX:MaxPermSize=512m
  </code></pre>
  
  <p>Restarted eclipse and retried. Unfortunately the same problem still existed. </p>
  
  <p>Finally, I tried introducing reduced caching on the wsdl using Axis2 config. Modified Axis2.xml to include the following:</p>
  
  <pre><code>&lt;parameter name="reduceWSDLMemoryCache"&gt;true&lt;/parameter&gt;
  </code></pre>
  
  <p>Unfortunately, same problem persists.</p>