+ Start a Discussion

java.lang.OutOfMemoryError: Java heap space.

I need to push large files to Content folder to salesforce.com using the java API. I'm passing data to salesforce.com using SOAP messages.


I'm able to push files upto 7MB but if I push the files larger than 7MB I get the following error

java.lang.OutOfMemoryError: Java heap space


I have increased the heap size to 1024MB but of no use. The eclipse.ini file looks like 




Can someone please suggest how can this problem be resolved.



I'm able to resolve the OutofMemory problem by increasing the memory size of the application that was trying to upload the document in the content folder. I had success in pushing the document of size 20 MB. To push the file of 20 MB to salesforce it took around 4-5 mins.


Now I'm trying to push a file of 30 MB and I'm getting no response back from salesforce.com.  

Given that you've already had issues with memory, check that you're not spending too much time in GC. If you're using Sun's JDK, you can use jconsole to attach to a running jvm and see information on GC (and lots of other things). If GC time isn't too overwhelming, you can use the Thread tab to get stack traces of individual threads to see if you're actually blocking on Salesforce responding or waiting on some other layer in your SOAP stack.