views:

155

answers:

2

If a one-shot timer was scheduled via

schedule_timer(timer,0,ACE_Time_Value(delay),ACE_Time_Value::zero)

is cancel_timer required in order to avoid a memory leak?

A: 

The timer object will not be released by ACE, but any data structure needed by ACE to maintain the timer will be released after the timer is run.

Two ways to verify this:

  • Read the ACE source code (not fun)
  • Run a small test program under valgrind
Baruch Even
+1  A: 

I think the answer is "it depends". With anything but relative ancient versions of ACE, you can have the Reactor (or Timer_Queue) increase the reference count on your event handler, and decrement it when the event handler is removed from the Reactor (or Timer_Queue.) Please notice that reference counting is optional, and has to be enabled.

In addition, I have not used this stuff, read the documentation and test!

coryan