function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

java.lang.OutOfMemoryError: Java heap space

I'm trying to compile a project that pulls some information from salesforce but get an out of memory error during the compile.  If I put the code in a standalone project and run it in a static main it works fine.  If i add it to the existing project and call it I get the oom error when compiling the salesforce packages generated from the wsdl file.


I have increased my heap size: -vmargs -Xms512M -Xmx1024M  with no effect.


This is the error message I get in the console window of eclipse:


 [javac] C:\SourceControl\mysybase\web_mainline\partner_portal\webapp\src\com\sforce\soap\enterprise\ warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.Vector
    [javac] cachedSerClasses.add(cls);
    [javac] ^
    [javac] The system is out of resources.
    [javac] Consult the following stack trace for details.
    [javac] java.lang.OutOfMemoryError: Java heap space



Any help would be greatly appreciated.

In my experience a heap size exception is often caused by an infinite loop -- did you debug into that add() statement to understand if you're accidentally adding stuff to a vectory infinitely?
Did you increase the heap size for the java instance used to compile or the one used to run the compiled classes? You need the former, not the latter.