Print this page

Receiving error "Java Heap Space" from the Data Loader UI

Knowledge Article Number 000170855
Description Issue : Receiving error "Java Heap Space" from the Data Loader UI version 21.0 onwards

Resolution Resolution : 

This behavior of Data Loader version 21.0 and above has been changed.

Dataloader runs on Java, and the issue occurs when the JVM runs out of the memory allocated to it when executed. From Dataloader version 21 onwards, the heap size is more restrictive than previous versions, which is why the issue was less likely to occur in previous releases. In some scenarios (eg. when extracting attachments), it is occurring due to the nature of the content being downloaded, which would increase the amount of required memory on the local system (JVM). 

Starting from Data Loader version 21.0 and higher, the behavior of the Data Loader has been changed, and the heap size is not set high any more. The general (and most common) use case for Dataloader is to export (or import) rows of data (strings, number etc.) from an org, which have a much more modest memory requirement. It is very difficult to define a heap size that would be suitable for all user scenarios, while still keeping its memory footprint and requirements modest. 

There are two solutions for this problem:

1. Use Data Loader version 20.0. You can download it from this link : 

Note: This Data Loader version is not available for use in Sandboxes. For more information, see Apex Data Loader version13 - 23 no longer connects to sandboxes.

2. Increase the java heap size for the Data Loader startup command (preferred method). Examples below assume that Data Loader is installed in the default location. If Data Loader is installed in a different folder, then the startup command below will look differently.

a)  If you have Data Loader shortcut on the Desktop, right-click the shortcut, select properties from the menu that opens, and in the target field modify it to look like this: 

"C:\Program Files (x86)\\Data Loader\Java\bin\javaw.exe" -Xms1024m -Xmx1256m -Dappdata.dir="C:\Users\<user>\AppData\Roaming" -jar "C:\Program Files (x86)\\Data Loader\dataloader-26.0.0-uber.jar" 

where <user> is the username of the User of the machine. 

For Data Loader Version 37 on Windows 7, the path might look like

"C:\ProgramData\Oracle\Java\javapath\javaw.exe" -Xms1024m -Xmx1256m -Dappdata.dir="C:\ProgramData" -jar "C:\Program Files (x86)\\Data Loader\dataloader-37.0.0-uber.jar"
b) If you do not have Data Loader shortcut on the Desktop, then click on Start Button>All Programs>>Data Loader and right click on the Data Loader icon there, select Properties from the popup menu that opens, and follow the steps described under a).

It might be required to go through several iterations of the steps above to find the right heap size. When setting the heap size the total amount of memory present on the system must be taken into account. Also if the system run 32 bit OS, then the heap size cannot be bigger than 2 GB. Please refer to the Java documentation for more details.

Also, lowering the batch size on data loader settings to 1 or 2 can also help resolve the heap size error.

promote demote