[Soot-list] Potential Memory leak
Eric Bodden
eric.bodden at mail.mcgill.ca
Fri Jul 17 11:18:05 EDT 2009
Thanks, Jochen.
I have just changed the implementation of remove to:
public void remove(Object obj)
{
int i = 0;
while (i < this.numElements) {
if (elements[i].equals(obj))
{
numElements--;
//copy last element to deleted position
elements[i] = elements[numElements];
//delete reference in last cell so that
//we only retain a single reference to the
//"old last" element, for memory safety
elements[numElements] = null;
return;
} else
i++;
}
}
This should do the trick, I guess.
I also emailed our admin to fix bugzilla.
Eric
2009/7/17 Patrick Lam <plam at cs.mcgill.ca>:
> Jochen Wuttke wrote:
>> Depending on how long-living the SparseSet and its elements are, this
>> can pose a problem.
>
> ArraySparseSets aren't supposed to be long-lived, because the analysis
> clients are generally supposed to copy the results out of the
> ArraySparseSets and do whatever they need to using the results. However,
> it would probably still help to get rid of the memory leak. Thanks for
> the report!
>
> pat
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
--
Eric Bodden
Sable Research Group, McGill University
Montréal, Québec, Canada
More information about the Soot-list
mailing list