[Spread-users] possible memory leak in spread daemon
jesus at omniti.com
Sat Feb 21 21:13:19 EST 2004
On Feb 21, 2004, at 8:34 PM, Taj Khattra wrote:
> (1) there is no call to sl_remove_all() when MembersList is empty in
that should be looked into. sounds suspicious.
> (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
> in the "if (grp->num_members == 0)" block and the leak went away.
That isn't a good approach. In my private copy of the skiplist
implementation, there is another call added. to actually free the
skiplist internals too.
sl_remove_all() was designed to remove all the elements. If you also
remove the index, you alter the "properties" of the skiplist if you
were to then add elements to it.
In my API here I have an sl_destruct(Skiplist *sl) that performs that
same tasks as sl_remove_all, but also frees other internals. I'll see
about applying it to the current Spread tree and sending in a patch.
// Theo Schlossnagle
// Principal Engineer -- http://www.omniti.com/~jesus/
// Postal Engine -- http://www.postalengine.com/
// Ecelerity: fastest MTA on Earth
More information about the Spread-users