Thursday, 12 December 2013

Data Loader Java Heap Space Error

Exporting or inserting attachments using Apex Data Loader via the command line will often fail with an 'out of memory' error due to a lack of java heap space. This can fixed by expanding the heap size in the process.bat file in the bin folder using the -Xms and -Xmx switches:

..\_jvm\bin\java.exe -cp ..\DataLoader.jar -Xms32m -Xmx128m -Dsalesforce.config.dir=%1 com.salesforce.dataloader.process.ProcessRunner %PROCESS_OPTION%

When not specified, the heap size defaults to 1MB but will increase to 16MB as needed. The above code increases the allotted memory to 32MB and allows for expansion to 128MB if needed.

See this article by Brett Spell for more on setting heap sizes. Thanks also to Anna478 and Demand Chain Sysytems.

No comments:

Post a Comment