登陆mysql数据库查看内存
mysql> select event_name,current_alloc from sys.memory_global_by_current_bytes limit 10;
+--------------------------------------------------------------------+---------------+
| event_name | current_alloc |
+--------------------------------------------------------------------+---------------+
| memory/innodb/buf_buf_pool | 4.09 GiB |
| memory/innodb/hash0hash | 114.91 MiB |
| memory/sql/TABLE_SHARE::mem_root | 114.68 MiB |
| memory/sql/TABLE | 75.82 MiB |
| memory/temptable/physical_ram | 73.00 MiB |
| memory/innodb/memory | 67.51 MiB |
| memory/innodb/ut0new | 64.08 MiB |
| memory/mysys/IO_CACHE | 60.98 MiB |
| memory/performance_schema/events_statements_summary_by_digest | 39.67 MiB |
| memory/performance_schema/events_errors_summary_by_thread_by_error | 36.27 MiB |
+--------------------------------------------------------------------+---------------+
10 rows in set (0.00 sec)

mysql>

mysql> select host,current_allocated from sys.memory_by_host_by_current_bytes;
+---------------+-------------------+
| host | current_allocated |
+---------------+-------------------+
| xx.xx.xx.xx | 183.54 GiB |
| 127.0.0.1 | 16.29 GiB |
| localhost | 70.63 MiB |
| background | -183.39 GiB |
+---------------+-------------------+
10 rows in set (0.02 sec)

#free -m
total used free shared buff/cache available
Mem: 7783 5624 63 522 2095 1503
Swap: 16379 2 16377

我物理内存8G,你咋还查出来183.54GiB,只能说mysql在内存方面的监控很烂啊,希望以后有所改进,还是通过操作系统命令top来看比较准一些。
如下图:
mysql 内存说明
看VIRT和RES即可,如果和你配置的数据库buffer差不多,就不存在内存泄漏。我们如果想看在某个时间点哪个SQL占用了多少内存这个目前还做不到啊 。内存不够该扩容就扩容,就这么简单。