Custom data type with a time watcher and memory control at process exit.

vvvua vvvua at lost.in.ua
Thu Oct 7 12:42:12 CEST 2010


Hello.
I'm trying to handle with possible memory leaks in my project and have 
some trouble with exit before timer's callback function starts. I'm 
using Linux debian/g++.
So, if I have started 3 timers with custom data and allocation as

     TimeSockMapper *mtm = new TimeSockMapper();
     mtm->repeat = 0;
     mtm->fd.clear();

     ev_timer_init (&(mtm-> tm), heartbeat_cb, 0.001, 0.001);
     ev_timer_start(timeloop, &(mtm->tm));

where "TimeSockMapper" is my custom data block:

struct TimeSockMapper
{
     struct ev_timer tm;
     ev_tstamp repeat;
     ClientID fd;
     void *defPoint;
     TimeSockMapper()
     {
         defPoint = NULL;
     }
};


How can I rise all watchers on a defined "timeloop" to free a memory ?

Thanks.



More information about the libev mailing list