Fri, 14 Aug 2015 12:36:41 +0900 reachableroots: fix memleak of integer objects at includepath loop
Yuya Nishihara <yuya@tcha.org> [Fri, 14 Aug 2015 12:36:41 +0900] rev 26033
reachableroots: fix memleak of integer objects at includepath loop In the first visit loop, val is decref-ed correctly after PySet_Add(). Let's do the same for the includepath loop.
Fri, 14 Aug 2015 12:31:56 +0900 reachableroots: bail if integer object cannot be allocated
Yuya Nishihara <yuya@tcha.org> [Fri, 14 Aug 2015 12:31:56 +0900] rev 26032
reachableroots: bail if integer object cannot be allocated This patch also replaces Py_XDECREF() by Py_DECREF() because we known "val" and "p" are not NULL. BTW, we can eliminate some of these allocation and error handling of int objects if the internal "seen" array has more information. For example, enum { SEEN = 1, ROOT = 2, REACHABLE = 4 }; /* ... build ROOT mask from roots argument ... */ if (seen[revnum + 1] & ROOT) { /* instead of PySet_Contains(roots, val) */ >From my quick hack, it is 2x faster.
(0) -10000 -3000 -1000 -300 -100 -30 -10 -2 +2 +10 +30 +100 +300 +1000 +3000 +10000 tip