libtcmalloc 简单使用

时间:2022-11-28 10:55:56

下载地址: https://github.com/gperftools/gperftools
这个编译很简单,直接进入vsprojects\libtcmalloc_minimal,用vc编译即可,整个过程倒是很顺利

用的时候包含头文件和lib即可

不过需要注意2点

1.不能和vld一起使用,否则会在tcmalloc的PopulateWindowsFn函数里面崩溃,因为取不到函数地址

这种原理都是对系统的内存函数做hook,冲突也是正常的

2.记得设置下Force Symbol References

"Configuration Properties"->"Linker"->"Input"

libtcmalloc 简单使用