On Tue, May 19, 2009 at 11:46 PM, Nick Mathewson wrote: > On Tue, May 19, 2009 at 10:20:08PM +1000, Peter Ross wrote: >> Hi, >> >> I've been tracking down a bug with boehm gc prematurely collecting the >> bufferevent callback arg value. This occurs when one is the middle of >> processing another bufferevent in the read callback. >> >> I've tried to grok the code to understand how one would get from the >> eventbase to the other bufferevent, so I can check where the boehm gc >> is losing the pointer, but having difficulty understanding the code. >> >> Could someone explain how I get from an event base to all the >> bufferevents associated with that base? > > You don't. Only when a bufferevent is actively listening for read or > write events does it have any references from the event base. > The bufferevent is listening for more read data
Assuming that the event_base is at address 0x4803d38 and fd is the file descriptor of the bufferevent that we are interested in. Then I think this is how you get from the base to the event associated with this base. *(((struct evmap_io *) ((struct event_base *) 0x4803d38)->io->entries[fd])->events->tqh_first) Anyway there is no tricky bit twiddling going on to confuse the gc, so as far as I can see the gc should be able to trace all this memory. Pete _______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users