问题描述
我正在使用tcmalloc,并且希望在不使用HEAPCHECK的情况下检查泄漏,因为这会使我的程序运行非常缓慢。是否可以从提供内存信息的MALLOCSTATS进行检查。我想知道如何读取它的分配和释放,以便我可以说是否有泄漏。我不担心位置或造成泄漏的原因。
这是我从MALLOCSTATS获得的输出。在程序运行之前,我还将获得2套内存统计信息,在程序完成之后,还将获得2套内存统计信息。这是什么原因呢?没有太多的文档。
Bytes released to the OS take up virtual address space but no physical memory.
------------------------------------------------
MALLOC: 140664 ( 0.1 MiB) Bytes in use by application
MALLOC: + 679936 ( 0.6 MiB) Bytes in page heap freelist
MALLOC: + 215720 ( 0.2 MiB) Bytes in central cache freelist
MALLOC: + 0 ( 0.0 MiB) Bytes in transfer cache freelist
MALLOC: + 12256 ( 0.0 MiB) Bytes in thread cache freelists
MALLOC: + 2490368 ( 2.4 MiB) Bytes in malloc Metadata
MALLOC: ------------
MALLOC: = 3538944 ( 3.4 MiB) Actual memory used (physical + swap)
MALLOC: + 0 ( 0.0 MiB) Bytes released to OS (aka unmapped)
MALLOC: ------------
MALLOC: = 3538944 ( 3.4 MiB) Virtual address space used
MALLOC:
MALLOC: 36 Spans in use
MALLOC: 2 Thread heaps in use
MALLOC: 8192 tcmalloc page size
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)