mysql never realase memory
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
mysql-5.7 (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Mysql gradually consumes memory . The memory is never released back to OS . The easiest way to reproduce the issue is run few mysqldumps and observe memory usage.
I used :
mysqldump DB1 > /dev/null &
About 5-6 times.
After dumps are completed mysql do not release memory and continue to consume even more memory.
Mysqld process uses all system memory, then starts to use swap memory up to the point where the database is killed by OOM errors.
here is memory usage after few mysqldumps commands :
ps -aux | grep mysql
mysql 607 0.7 49.0 1769788 1005184 ? Ssl Aug10 10:50 /usr/sbin/mysqld
1GB on a system with 128MB innodb buffer pool. Performance schema does not report any issues and states that myslq is taking only around 400MB .
The issue seems to be related to the default memory allocation library malloc. Installing jemmalloc and forcing jemmalloc in mysql conf seems to resolve this issue .
I used the same method as described before and memory usage looks stable :
ps uax | grep mysql
mysql 1540 5.9 23.4 957244 481036 ? Ssl 12:59 4:38 /usr/sbin/mysqld
Same issue and workaround was reported on mysql bug forum by Machiel Richards .
lsb_release -rd
Description: Ubuntu 16.04.2 LTS
Release: 16.04
mysql-server:
Installed: 5.7.19-
Candidate: 5.7.19-
Version table:
*** 5.7.19-
500 http://
500 http://
100 /var/lib/
5.
500 http://
Status changed to 'Confirmed' because the bug affects multiple users.