2015年(6)
分类: C/C++
2015-06-15 21:11:22
By default, tcmalloc will release no-longer-used memory back to the kernel gradually, over time. The MallocExtension::instance()->ReleaseFreeMemory();
You can also call SetMemoryReleaseRate() to change the tcmalloc_release_rate value at runtime, or GetMemoryReleaseRate to see what the current release rate is.
TCMALLOC_RELEASE_RATE | default: 1.0 | Rate at which we release unused memory to the system, via madvise(MADV_DONTNEED), on systems that support it. Zero means we never release memory back to the system. Increase this flag to return memory faster; decrease it to return memory slower. Reasonable rates are in the range [0,10]. |
MallocExtension::instance()->ReleaseFreeMemory()
强制释放。
最后在代码中加入了ReleaseFreeMemory,问题解决