Increasing Memory Allocation for Java
If you are working with a large project with extensive metadata or key references, you may need to increase the amount of memory that is allocated to the Java process that performs the publishing.
There can be two situations where an out of memory error can be
triggered:
- From the DITA-OT basic processing (the preparation of the merged HTML document).
- From the Chemistry PDF CSS processor (the transformation of the merged HTML document to PDF).
When the Transformation is Started from Oxygen
To alter the memory allocation setting from the transformation scenario, follow these
steps:
- Open the Configure Transformation Scenario(s) dialog box.
- Select your transformation scenario, then click Edit.
- Go to the Advanced tab.
- Uncheck the Prefer using the "dita" command option
- Locate the JVM Arguments and increase the default value. For
instance, to set 2 gigabytes as the maximum amount of memory, you can use:
-Xmx2g
. If you do not specify the -Xmx value in this field, by default, the application will use a maximum of 512 megabytes when used with a 32-bit Java Virtual Machine and one gigabyte with a 64-bit Java Virtual Machine.
Note: This memory setting is used by both the DITA-OT process and the Chemistry CSS
processor.
When the Transformation is Started from the Command Line
- If the DITA-OT process fails with Out Of Memory Error: you can change the value
of the
ANT_OPTS
environment variable from a command line for a specific session.Example: To increase the JVM memory allocation to 1024 MB for a specific session, issue the following command from a command prompt (depending on your operating system):- Windows
set ANT_OPTS=%ANT_OPTS% -Xmx1024M
- Linux/macOS
export ANT_OPTS="$ANT_OPTS -Xmx1024M"
Tip: To persistently change the memory allocation, change the value allocated to theANT_OPTS
environment variable on your system. - Windows
- If the Chemistry PDF CSS processor fails with an Out Of Memory Error: try adding
the
baseJVMArgLine
parameter to the DITA-OT command line. For example:-DbaseJVMArgLine=-Xmx2048m