This article is also available in Chinese: 中文版. Browse all English articles.
Memory leaks and high memory usage are common problems in MySQL, and diagnosing them depends heavily on good memory-monitoring data. MySQL’s Performance Schema provides memory monitoring, but the granularity of PFS’s memory statistics is coarse, which makes it hard to pinpoint the exact code responsible.
The figure above shows the memory information monitored by PFS.
Although the monitoring shows that a lot of memory is allocated
on String::value and
thd::main_mem_root, these are basic objects used in
many places throughout MySQL, so we cannot infer from this which
operation actually caused the memory usage. In addition, PFS
itself has relatively high memory overhead and …