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)
Caution: If there isn’t enough memory available on the server or container, allocating more heap size won’t help. Check system resources first.
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
Before starting: Back up the original configuration file before making changes.
Don’t set the heap size higher than 75% of the total available system memory. Doing so can cause the entire system to become unstable or unresponsive.
For Docker deployments
Configure the environment variable WPR_JVM_MAX_MEMORY_SIZE_MB with the desired value in megabytes.
Example docker run command:
Note: If this variable isn’t explicitly set, the application uses the default value of 2048 MB.
Monitoring and troubleshooting
How to monitor performance
Check the server or container CPU usage during normal operation. A sustained CPU spike can indicate memory pressure.
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
Checks are still slow after increasing memory
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.
The application won’t start after changing the memory setting
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.
The memory value doesn’t seem to take effect
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.
Out-of-memory errors occur even with a high heap size
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
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?