Why does my Liferay Docker container slowly accumulate memory over time and run into OutOfMemoryErrors?
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
legacy-article
learn-legacy-article-disclaimer-text
Issue
- In some implementations of containerized Liferay Docker environments, there are reports of memory usage slowly increasing over time until an OutOfMemoryError is reached or the pod alerts trigger a kill of the pod.
- After observing that native OS memory allocated to JVM threads are not getting released completely, the current explanation for this is that the OS’s `malloc` implementation from the glibc library is responsible for this.
- As Liferay spawns a large amount of threads, this issue may make itself more apparent, especially for installations that serve a large number of users.
Environment
- Liferay PaaS
- Quarterly Release
Resolution
- TCMalloc was added to mitigate this issue.
- The environment variable to enable TCMalloc should be configured in the Liferay service Cloud Console or LCP.json file by setting the DOCKER_TCMALLOC_ENABLED variable to true
did-this-article-resolve-your-issue