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

vvvua vvvua at
Thu Oct 21 18:26:02 CEST 2010

On 21.10.2010 18:51, Marc Lehmann wrote:
> On Thu, Oct 21, 2010 at 05:13:46PM +0300, vvvua<vvvua at>  wrote:
>>>> I have to cancel watchers, destroy the loop and free memory.
>>> If the process itself is shutting down (exiting?) then freeing the
>>> watchers is just wasting cpu cycles, the OS does it for you, and much
>>> faster.
>> I know that but parent process isn't OS.
> Yes, the parent process will not clean up for you, but the OS will do,
> regardless of your parent process or not.
>> So the right way is:
>> 1) To store list of pointers to watchers.
>> 2) When the callback rises, delete the pointer from the list and
>> free memory.
>> 3) At the end of the process free memory with help of list.
> You can do that, but really, the OS will do it for you much faster. Big
> promise :)
I mean "process" as a part of the program, not the system process 
(forked or cloned).

More information about the libev mailing list