CentOS Linux release 7.3.1611
gcc version 4.8.5 20150623
gperftool 2.4-8.el7
1.my c++ program which links -ltcmalloc works fine without HEAPCHECKER or HEAPPROFILE. The memory it used stabilizes at 5M~10M.
2.if I run the program using heap-checker with env HEAPCHECKER=NORMAL,the memory increases about 50M per hour until OOM killer.
3.if I use heap-profile with env HEAPPROFILE="./hp" HEAP_PROFILE_ALLOCATION_INTERVAL=100000000, the memory increases about 100M per 40 minutes and also OOM is triggered.However, when I use pprof to analysis the heap file,it shows the total memory is only 0.1MB where I expect 100M.
I know heap-checker and heap-profile will cause extra memory use because they need to record some other information to trace memory allocation,but I don't think it is the reason for my case.
I use heap-checker and heap-profile with another small program,which works quite good.
The biggest difference between these two program is, the faulty program uses coroutine, by which i mean function swapcontext, getcontext and makecontext.
My questions are:
Q1.Why does the heap file opened by pprof show total memory is 0.1M when I set HEAP_PROFILE_ALLOCATION_INTERVAL=100000000?
Q2.Is it possible that heap-checker or heap-profile do not cooperate well with those coroutine functions?