[Soot-list] Potential Memory leak
Jochen Wuttke
wuttkej at usi.ch
Fri Jul 17 05:32:13 EDT 2009
Hi,
I've been looking at the implementation of
soot.toolkits.scalar.FlowSet and I think the ArraySparseSet may
contain a memory leak.
In the remove() method, if an element is removed, the last element in
the array is "copied" to the location of the removed element, and the
"numElements" pointer is decremented. If the copied element is then
removed, the array still retains a reference to it and prevents
garbage collection. Like this
[ obj1, obj2, obj3, obj4 ], numElements=4
remove(obj2)
[obj1, obj4, obj3, obj4 ], numElements=3
remove(obj4)
[obj1, obj3, obj3, obj4 ], numElements=2
Depending on how long-living the SparseSet and its elements are, this
can pose a problem.
I tried to file a report in Bugzilla but I get only empty pages
returned.
Jochen
More information about the Soot-list
mailing list