An investigation into unexpected memory growth in Percona Server for MySQL reveals that cursor metadata in stored procedures is never freed during repeated calls within long-lived connections. Under heavy TPC-C benchmark load (HammerDB), RSS grew from ~80GB to over 180GB over 24 hours, eventually triggering OOM kills. Memory profiling pinpointed MEM_ROOT allocations for cursor metadata as the culprit. Two practical mitigations are identified: limiting connection lifetime (with connection pooling to minimize overhead) and adding brief pauses between transactions. A bug has been filed against Percona Server. The root cause exists in both MySQL 8.4 and 9.x codebases.
Table of contents
1. What it is about2. Realities of stress testing3. Configuration and methodology4. Where did the memory go?5. Possible workarounds6. Summary2.7K Impressions