I just create a new event with event_new(),
and finally del it with evtimer_del().
Then valgrind warning me there is memory leak(128 bytes in 1 blocks).
What do I missed?
The code:
evthread_use_pthreads();
auto _base = event_base_new();
event_init();
event* _timer = event_new(_base, -1, EV_TIMEOUT, NULL, NULL);
evtimer_del(_timer);
event_base_free(_base);
You are using wrong deallocation function, from docs:
event_new()
Returns
a newly allocated struct event that must later be freed withevent_free()
.
While evtimer_del
is an alias for event_del()
which only unlists event.