[Spread-users] possible memory leak in spread daemon
Taj Khattra
taj.khattra at pobox.com
Sat Feb 21 20:34:08 EST 2004
hello,
i think i've run into a memory leak too with the latest release
spread-src-3.17.2rc2. i was running a simple regression test in a
tight loop (with a single daemon on localhost) and noticed that the
daemon's memory size was increasing steadily.
i used a leak detector, and tracked it down to the following call chain:
sl_init(skiplist.c,93): 8514 340560 52.02%
G_handle_join(groups.c,755):
Sess_handle_join(session.c,1924):
Sess_deliver_message(session.c,1841):
Deliver_agreed_packets(protocol.c,1010):
Prot_handle_token(protocol.c,640):
E_handle_events(events.c,675):
main(spread.c,193)
this is the initialization of a new group's MembersList skiplist in
G_handle_join().
it seems like the memory allocated for sl->index in sl_init() is not
being freed ? i took a quick look at the code, and i think there are
at least two issues:
(1) there is no call to sl_remove_all() when MembersList is empty in
G_handle_leave()
(2) sl_remove_all() doesn't free the memory allocated for sl->index
in sl_init()
i'm not sure if this is the correct fix or not, but i added the line
if (sl->index != NULL) free(sl->index)
to sl_remove_all() and added a call to sl_remove_all() in G_handle_leave()
in the "if (grp->num_members == 0)" block and the leak went away.
i haven't hit any other leaks, but if this is the correct fix then i
think there may be a few other places in groups.c that also need a call
to sl_remove_all() added.
thanks
-taj
More information about the Spread-users
mailing list