Bug #108019 memory leak caused by binlog
Submitted: 29 Jul 2022 2:15 Modified: 29 Jul 2022 12:19
Reporter: david Bruce Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.0.23 OS:CentOS (7)
Assigned to: CPU Architecture:x86

[29 Jul 2022 2:15] david Bruce
Description:
When I execute a batch insert statement, if binlog is turned off, the actual system memory allocated and occupied by mysqld stays at a level after the InnoDB buffer pool is full.

However, if you turn on binlog, the allocated memory continues to grow after the InnoDB buffer pool is full, and tends to grow as long as the process does not end.

Looking at the five memory-related tables of mysql's "performance_schema", no suspected memory-occupying unreleased items were found, including "mysql/sql/Log_event", which shows how much memory is released as much memory is allocated.

When using viewing tools such as PMAP and SMAP to continuously track the memory distribution of the mysqld process, it is found that the heap space of mysqld is growing after the InnoDB buffer pool is full, while "performance_schema.memory_summary_global_by_event_name" shows that all memory allocation and release of "mysql/sql/Log_event" are normal, and all problems disappear after closing binlog

How to repeat:
environment:
   mysql8.0.23
   CentOS Linux 7 (Core)

Insert enough data to ensure that mysqld memory usage can continue to be tracked when the InnoDB buffer pool is full
[29 Jul 2022 12:19] MySQL Verification Team
Thank you for taking the time to report a problem.  Unfortunately you are not using a current version of the product you reported a problem with -- the problem might already be fixed. Please download a new version from http://www.mysql.com/downloads/

If you are able to reproduce the bug with one of the latest versions, please change the version on this bug report to the version you tested and change the status back to "Open".  Again, thank you for your continued support of MySQL.

Also, this behaviour is very well known on Linux, where malloc libraries tend to keep allocated memory with the process, for the sake of faster future allocations ......