Lucee Heap Memory Exhausting on Production

Hello Support Team,

We are facing a recurring heap memory exhaustion issue with our Lucee server. Here are the details:

  • Traffic: Our application serves around 1 million API requests per day. These are not large payloads or responses.
  • Server Specs:
    • Total RAM: 32 GB
    • Heap allocation: 24 GB (set for JVM)
  • Problem: Every 4–5 days, the heap memory becomes fully utilized and does not release as expected. Once heap is exhausted, Lucee starts consuming the remaining server memory until the machine becomes unstable, forcing us to restart the server to recover.
  • Impact: This creates downtime and requires manual intervention every few days.

Could you please advise on the following:

  1. Best practices for heap tuning with Lucee in high-traffic API workloads.
  2. Recommended GC (Garbage Collection) settings for this type of workload.
  3. Tools or methods to identify memory leaks within Lucee or our code.
  4. Any configuration guidance (e.g., caching, session handling, request handling) that may help avoid such heap growth.

We would greatly appreciate your guidance in diagnosing and resolving this issue, as it is becoming a critical bottleneck for our production system.

Don’t forget to tell us about your stack!

OS: Windows Server 2012 R2 (6.3) 64bit
Java Version: 21.0.2 (Eclipse Adoptium) 64bit
Tomcat Version: Tomcat 9.0
Lucee Version: Lucee 6.0.1.83

I would suggest to do an heapdump with jmap and analyze it. Most likely there will be a memory leak in your code.

Thanks for the suggestion @gunnar.lieb, I had taken the heap dump with jcmd multiple times and every time it captures only around 3GBs (no matter the lucee heap is at 15GBs even). Looks like the dump is not reading the lucee heap memory.

I have tried to list down all scope variables and their size also but that is very low in size also.