best ways to do clean up

Juan Pablo L jpablolorenzetti at
Tue Dec 28 23:46:25 CET 2010

Hi, i have a question about cleaning up memory when a loop is exiting, i
have done some glib so my experience is only glib's main loop but i m trying
to figure out how thing work in libev. i m new to libev.
What i m trying to do is a custom watcher, in glib you override the
check/prepare/dispatch and finilize so when the loop in glib is exiting
the loop itself would call the finalize function on all event sources
(watches in libev) automatically but in libev you do not get to
customize the check/prepare/dispatch/finalize functions (although you can
modify prepare and check but at the loop level and not at the watcher level)
so i m not sure what is the correct way to do this in libev, i saw a
ev_cleanup watcher , so the libev solution for cleaning up some memory used
for other watchers at the end of the loop
would be to register a watcher per watcher-to-clean so they do the cleaning
at the end?, just a clarification, i m making a server and i create a new
thread per connection and each thread has
its own loop so i can not leave the OS clean the memory as one loop
destroying does not mean the application is exiting, it means only one
client disconnecting. thanks!!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the libev mailing list