我正在调试MySQL 5.7.37中的内存泄漏,运行以下查询可以了解每个线程运行的线程和内存分配情况。
select * from sys.memory_by_thread_by_current_bytes输出显示了一些在total_allocated中具有GiB值的线程。但是,current_allocated值仍然在MiB中。我看到的一些值如下:
我如何解释上述数据?这是否意味着total_allocated内存是从内存中为这个线程保留的?
发布于 2023-03-11 20:49:03
正如文档:current_allocated中所提到的,线程当前分配的字节数尚未被释放。
total_allocated -线程的total内存分配以字节为单位。
其他查询可能会给您提供更多信息。
select * from sys.memory_global_total;
select thd_id,conn_id, current_memory from sys.session;
select * from memory_summary_by_thread_by_event_name where thread_id= "ID of the thread with high memory usage" order by CURRENT_NUMBER_OF_BYTES_USED;
select thread_id, user, current_allocated from memory_by_thread_by_current_bytes;内存使用率高的常见原因可能是:
有关更多细节,您可以查看此页。
https://dba.stackexchange.com/questions/324643
复制相似问题