Update the Java Virtual Machine Memory Allocation

You might occasionally see "fatal exception" or "out of memory" errors from the language server or core server. These errors occur when the Java Virtual Machine is unable to request more memory from the operating system, which causes the server to run out of processing capacity. For the language server, these errors are especially common when checking large documents, generally larger than 1 MB. For the core server, they can occur when you try to import large volumes of terminology data, for example.

When this happens, you can allocate more memory to the relevant server. However, if you’re using all available memory, you might want to look at upgrading your hardware.

A number of factors in a document determine the processing workload of the language server:

FactorExplanation
The amount of checked text

The checked text is the raw text sent to the server after XML tags have been stripped out. A document with a large file size can have a high proportion of XML code, meaning that the size of the raw text sent to the language server is actually quite small in comparison to the overall file size.

Conversely, if a document contains large blocks of text and minimal XML code, it could take longer to process despite a smaller file size.

The number of issues highlighted in the document

A significant part of the workload for the language server involves rendering highlighted information into XML that can then be used by the integrations to highlight the text and generate reports. The language server can process a large document if the document contains a minimal number of highlights, but may report an error processing another document of the same size if that document contains a higher proportion of highlighted issues.

Allocating more memory to the language server can prevent problems caused by large documents. You can configure two types of memory allocation limits.

Initial memory

The initial memory limit is the initial amount of memory allocated to the language server when it starts. By default, this amount is lower than the maximum memory limit to prevent the server from reserving more memory than it initially needs. If the language server later needs more memory than it initially reserved, it can request up to the amount defined in the maximum memory limit.

Maximum memory

This is the maximum amount of memory consumption that the language server is allowed to reach at any given time. This shouldn’t be greater than the actual capacity of your hardware.

Remember: A 32-bit operating system with a 32-bit Java Virtual Machine has a fixed maximum memory limit of 1,596 MB (regardless of hardware capacity).

You can increase your Java Virtual Machine memory allocation to reduce "fatal exception" or "out of memory" errors.

Adjusting the Java Virtual Machine Memory Allocation

To configure the memory allocation for your language servers or core server, follow these steps:

  1. First, identify the server file that you want to configure.

    • Configure all language servers if you're having trouble checking large documents. Use the file ls-common.wrapper.conf.

    • Configure the core server if you're having trouble importing large files. Use the file coreserver.wrapper.conf.
  2. Open your overlay of the file you identified in step 1: either ls-common.wrapper.conf or coreserver.wrapper.conf.

    If you haven’t yet created an overlay of this file, create a new version of the file at the following location:

    %ACROLINX_CONFIGURATION_ROOT%\server\bin\

    Don’t edit the installed version of the file. Instead, always edit your overlay in the configuration directory.

  3. Add the following properties:

    wrapper.java.initmemory=<SIZE_IN_MB> 
    wrapper.java.maxmemory=<SIZE_IN_MB>

    Adjust these numbers in accordance with your hardware capacity. When adjusting the numbers, you can assume that "more is better". As a guideline, a server using a maxmemory of 1024 MB can process documents of up to 1 MB of checked text.

    For example, to raise the initial memory allocation to 512 MB and the maximum memory allocation to 2048, add the properties as follows:

    wrapper.java.initmemory=512
    wrapper.java.maxmemory=2048
  4. Save your changes and restart all servers.