C++容器不释放内存的解决办法

使用jemalloc替代std::malloc。

安装jemalloc库,并进行对应的链接和环境变量配置:

export MALLOC_CONF="dirty_decay_ms:0,muzzy_decay_ms:0"
export LD_PRELOAD="/usr/local/lib/libjemalloc.so"

 

资料参考:

https://blog.csdn.net/weixin_30819085/article/details/101325304

https://blog.csdn.net/steve1018/article/details/26737277

https://blog.csdn.net/qq_16097611/article/details/118999271

posted @ 2021-08-24 15:22  倾越  阅读(485)  评论(0编辑  收藏  举报