On Fri, Nov 20, 2009 at 05:17:22PM -0800, Dan Kegel wrote:
> On Fri, Nov 20, 2009 at 5:05 PM, Haiping Zhao <hz...@facebook.com> wrote:
> > When I call event_base_loopexit() with a timeout, and say it?s not
> > triggered, because event_base_loopbreak() breaks out of the loop before
> > timeout is reached, I saw a memory leak of an event_once object, calloc-ed
> > inside event_base_once(), but never got a chance to get freed, because
> > free(eonce) is called inside timeout?s callback. How to fix this from
> > outside of libevent?
> 
> I think the answer is: don't use event_base_loopexit(); it's just
> a convenience function.  In this situation it's better to roll your own
> by creating an explicit event and adding it yourself, then you have
> more control.  See how I did it at
> http://codereview.chromium.org/372033/diff/1/3

I think you meant to say "don't use event_base_once(); it's just a
convenience function"?

(Not that there's anything wrong with it, but it doesn't give you an
event you can cancel or delete.  To make an event you can actually
talk about, you need to use event_set [or event_assign/event_new if
you're using Libevent 2.0].)

yrs,
-- 
Nick
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://lists.monkey.org:8080/listinfo/libevent-users

Reply via email to