开发者

Regarding timer_create (memory leak)

I am working on a memory leak tool, the thing is: this tool should catch memory leaks only from test program, but what actually happens is, i have created a timer using API timer_create (POSIX), and this is somehow causing a leak of 144+56 bytes.

Any idea, a开发者_C百科s to how to stop it? How can i make sure, that all malloc requests from timer_create are not logged?

I am using the timer thread function method, and not signal. SIGEV_THREAD


I don't see any N in your reported memory leakage, just what appears to be a small constant, so my initial guess is that this is purely one-time overhead of setting up the timer thread system and not an actual memory leak. Try running your program with strace and make sure the timer is destroyed. If so, whatever internal memory is left is a matter of the implementation's quality and not a potential error in your program.

By the way, another good test approach: create 10 or 100 timers, then destroy them all, and compare the amount of memory "leaked". If it's the same as with one, I would say there's no issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜