[Spread-users] possible memory leak in spread daemon

Taj Khattra taj.khattra at pobox.com
Sat Feb 21 20:34:08 EST 2004


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%

this is the initialization of a new group's MembersList skiplist in

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

(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.



More information about the Spread-users mailing list