On Thu, Oct 07, 2010 at 01:42:12PM +0300, vvvua <[email protected]> wrote:
> 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 ?
It's not quite clear to me what you want to know:
If you want to free watcher memory, then that's your job to do once you
stopped the watcher, as libev doesn't manage watcher memory itself.
If you want to free a whole loop (which incidentally stops all watchers) you
can call ev_loop_destroy() on the function.
Or maybe your goal is something else?
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / [email protected]
-=====/_/_//_/\_,_/ /_/\_\
_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev