-1

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, as 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

6
  • Did you know that there's already valgrind to detect memory leaks? Commented Apr 6, 2011 at 11:38
  • Can it detect memory leak on ARM and mips target? Commented Apr 6, 2011 at 11:40
  • @ThiefMaster: There is perhaps a bigger world, than the desktop, so please don't limit your thinking only to the x86 (the old Desktop) :-) Commented Apr 6, 2011 at 11:45
  • @kingsmaster1: Does the memory leak happen at each timer_create or only the first time? Some runtimes are used to do some dynamic allocations in a "lazy" way. In your case, the "timer" subsystem may allocate something at the first access, and it's intepreted as a "leak" by the checker. Bye! Commented Apr 6, 2011 at 12:28
  • @kingsmaster1: valgrind supports ARM, but not mips (valgrind.org/docs/manual/dist.news.html). There's a lot of MIPs tools suggested in this question: stackoverflow.com/questions/1906228/… Commented Apr 6, 2011 at 13:34

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.