Loading

Resolving the Java Heap Space Error in Salesforce Data Loader

Udgivelsesdato: May 22, 2026
Beskrivelse

Salesforce Data Loader runs on the Java Virtual Machine (JVM). A "Java Heap Space" error occurs when the JVM runs out of the memory allocated to it during a data operation (such as an import, export, or attachment download).

Why This Error Occurs

  • Data Loader uses Java, and each batch of records it processes requires JVM memory. If the batch size is too large or the data contains large content (such as attachments or files), the JVM exceeds its memory allocation.
  • Starting from Data Loader version 21, heap size is more restrictive than in earlier versions, making the error more likely.
  • Data Loader versions 45 and above use Zulu Java, which manages heap size more efficiently. This error is significantly less common in version 45+.
  • For operations such as exporting attachments or binary content, memory requirements are higher than for standard text/number field exports.
  • The JVM heap size cannot practically be set high enough to cover all data scenarios while keeping Data Loader's memory footprint reasonable for general use.
Løsning

Preferred Solution: Lower the Batch Size in Data Loader Settings

Reducing the batch size is the most effective and recommended fix for Java Heap Space errors.

  1. Open Salesforce Data Loader.
  2. Go to Settings.
  3. Lower the Batch Size setting. Start with a significantly reduced value (for example: 200, or as low as 1 for very large attachment exports).
  4. Retry the operation.

For detailed configuration steps, see Configure Data Loader.
Also ensure you are using the most recent version of Data Loader, as newer versions include performance improvements.

Alternative Solution: Increase Java Heap Size (Data Loader Versions 21–44 Only)

If lowering the batch size does not resolve the error and you are using Data Loader versions 21–44, you can manually increase the JVM heap size by modifying the Data Loader startup command.
Note: This workaround is generally not needed for Data Loader version 45 and above (Zulu Java).
If you have a Data Loader shortcut on the Desktop:

  1. Right-click the shortcut and select Properties.
  2. In the Target field, add the memory flags -Xms1024m -Xmx1256m to the command. The modified target should look like:
"C:\Program Files (x86)\salesforce.com\Data Loader\Java\bin\javaw.exe" -Xms1024m -Xmx1256m -Dappdata.dir="C:\Users\<user>\AppData\Roaming" -jar "C:\Program Files (x86)\salesforce.com\Data Loader\dataloader-26.0.0-uber.jar"

Replace <user> with the Windows username of the machine user.
For Data Loader version 37 on Windows 7:

"C:\ProgramData\Oracle\Java\javapath\javaw.exe" -Xms1024m -Xmx1256m -Dappdata.dir="C:\ProgramData" -jar "C:\Program Files (x86)\salesforce.com\Data Loader\dataloader-37.0.0-uber.jar"

If you do not have a shortcut on the Desktop:

  1. Click Start > All Programs > salesforce.com > Data Loader.
  2. Right-click the Data Loader icon and select Properties.
  3. Follow the same steps as above to modify the Target field.

You may need to try different heap size values depending on your system's total available memory. On 32-bit operating systems, the heap size cannot exceed 2 GB.

Vidensartikelnummer

000385819

 
Indlæser
Salesforce Help | Article