Configure JVM maximum heap size

The grammar component in the proofreader application runs on a Java Virtual Machine (JVM). By default, the JVM uses 2048 MB of memory, but this may need adjustment based on the language installation and system resources.

When to adjust the JVM memory

Understanding the default setting

The installation comes with a default maximum heap size of 2048 MB (2 GB).

This setting affects only the grammar component. It doesn’t affect spell checking or AI-driven checks. When the JVM doesn’t have enough memory, the garbage collector works harder to free up resources, which consumes more CPU and degrades performance.

Quick assessment based on languages

Use this quick reference to determine if the memory allocation needs adjustment:

  • 1 language installed: 1 GB is sufficient (the default or lower can be used)

  • 2–5 languages installed: 2 GB is sufficient (the default is appropriate)

  • 6–15 languages installed: 3 GB is recommended (the setting should be increased)

  • 15+ languages installed: 4 GB is recommended (the setting should be increased)

circle-exclamation

Early signs that more memory is needed

Monitor for these performance indicators that suggest the JVM heap size should be increased:

  • Checks take noticeably longer to complete

  • Server or container CPU usage spikes and stays high

  • Timeout errors occur

  • The application becomes unresponsive during peak usage

How to adjust the JVM memory

The method depends on the deployment type. Follow the instructions for the appropriate setup below.

For Linux and Windows installations

circle-info

Before starting: Back up the original configuration file before making changes.

1

Locate the configuration file

Find the AppServerX.xml file in the installation directory.

2

Edit the file

Open the file with a text editor.

3

Modify JVM max memory

Find the line containing <JVMMaxMemorySizeMb> and replace 2048 with the desired value in megabytes. For example, enter 3072 for 3 GB or 4096 for 4 GB.

4

Save and close

Save the file and close the editor.

5

Restart the service

Restart AppServer to apply changes in AppServerX.xml.

To restart: stop the application, then start it again.

Use Main AppServer commands.

circle-exclamation

For Docker deployments

Configure the environment variable WPR_JVM_MAX_MEMORY_SIZE_MB with the desired value in megabytes.

Example docker run command:

circle-info

Note: If this variable isn’t explicitly set, the application uses the default value of 2048 MB.

Monitoring and troubleshooting

How to monitor performance

1

Check the server or container CPU usage during normal operation. A sustained CPU spike can indicate memory pressure.

2

Review application logs for garbage collection messages or out-of-memory errors. These messages indicate that memory allocation isn’t adequate for the workload.

Common issues and solutions

chevron-rightChecks are still slow after increasing memoryhashtag

This could indicate that memory isn’t the bottleneck. Check CPU usage, network latency, or language complexity. If the CPU is already at capacity, increasing memory won’t help unless out-of-memory errors occur.

chevron-rightThe application won’t start after changing the memory settinghashtag

Verify that the entered value is a valid number (a whole number in megabytes). Check that other parts of the configuration file weren’t accidentally modified. Check logs for errors.

chevron-rightThe memory value doesn’t seem to take effecthashtag

Confirm that the file was saved and the application was restarted. For Docker, verify that the container was actually redeployed and that the new environment variable was passed through the orchestration configuration.

chevron-rightOut-of-memory errors occur even with a high heap sizehashtag

If the heap size has been set to 4 GB or higher and out-of-memory errors still occur, the system’s total available memory may be the limit. Consider upgrading the server hardware, removing unused language packs, or contacting support.

Key points to remember

  • The JVM heap size affects only the grammar component, not other proofreading features

  • The default is 2048 MB; adjust based on installed languages

  • CPU usage is a strong indicator of memory pressure; monitor it during grammar checks

  • Always back up configuration files before editing

  • Restart the application for changes to take effect

  • Don’t allocate more than 75% of total system memory to the JVM

circle-info

Note: If performance issues continue after adjusting memory, contact support with details about the language configuration, system resources, and error logs.

Last updated

Was this helpful?