|
7 | 7 | #include "pycore_freelist.h" // _PyObject_ClearFreeLists() |
8 | 8 | #include "pycore_initconfig.h" |
9 | 9 | #include "pycore_interp.h" // PyInterpreterState.gc |
10 | | -#include "pycore_time.h" |
11 | 10 | #include "pycore_object.h" |
12 | 11 | #include "pycore_object_alloc.h" // _PyObject_MallocWithType() |
13 | 12 | #include "pycore_object_stack.h" |
|
22 | 21 | // enable the "mark alive" pass of GC |
23 | 22 | #define GC_ENABLE_MARK_ALIVE 1 |
24 | 23 |
|
25 | | -// include addtional roots in "mark alive" pass |
| 24 | +// include additional roots in "mark alive" pass |
26 | 25 | #define GC_MARK_ALIVE_EXTRA_ROOTS 1 |
27 | 26 |
|
28 | 27 | // include Python stacks as set of known roots |
@@ -482,7 +481,7 @@ mark_alive_stack_push(PyObject *op, _PyObjectStack *stack) |
482 | 481 | } |
483 | 482 |
|
484 | 483 | // Need to call tp_traverse on this object. Add to stack and mark it |
485 | | - // alive so we don't re-visit it a second time. |
| 484 | + // alive so we don't traverse it a second time. |
486 | 485 | gc_set_alive(op); |
487 | 486 | if (_PyObjectStack_Push(stack, op) < 0) { |
488 | 487 | _PyObjectStack_Clear(stack); |
@@ -877,13 +876,17 @@ propagate_alive_bits(_PyObjectStack *stack) |
877 | 876 | // Using tp_traverse, mark everything reachable from known root objects |
878 | 877 | // (which must be non-garbage) as alive (_PyGC_BITS_ALIVE is set). In |
879 | 878 | // most programs, this marks nearly all objects that are not actually |
880 | | -// unreachable. Actually alive objects can be missed in this pass if |
881 | | -// they are alive due to being referenced from an unknown root (e.g. an |
882 | | -// extension module global), some tp_traverse methods are either missing |
883 | | -// or not accurate, or objects that have been untracked (and objects |
884 | | -// referenced by those). If gc.freeze() is used, this pass is disabled |
885 | | -// since it is unlikely to help much. The next stages of cyclic GC will |
886 | | -// ignore objects with the alive bit set. |
| 879 | +// unreachable. |
| 880 | +// |
| 881 | +// Actually alive objects can be missed in this pass if they are alive |
| 882 | +// due to being referenced from an unknown root (e.g. an extension |
| 883 | +// module global), some tp_traverse methods are either missing or not |
| 884 | +// accurate, or objects that have been untracked. Objects that are only |
| 885 | +// reachable from the aforementioned are also missed. |
| 886 | +// |
| 887 | +// If gc.freeze() is used, this pass is disabled since it is unlikely to |
| 888 | +// help much. The next stages of cyclic GC will ignore objects with the |
| 889 | +// alive bit set. |
887 | 890 | // |
888 | 891 | // Returns -1 on failure (out of memory). |
889 | 892 | static int |
@@ -1631,8 +1634,8 @@ gc_collect_main(PyThreadState *tstate, int generation, _PyGC_Reason reason) |
1631 | 1634 | (void)PyTime_PerfCounterRaw(&t2); |
1632 | 1635 | double d = PyTime_AsSecondsDouble(t2 - t1); |
1633 | 1636 | PySys_WriteStderr( |
1634 | | - "gc: done, %zd unreachable, %zd uncollectable, %zd long-lived, %.4fs elapsed\n", |
1635 | | - n+m, n, state.long_lived_total, d); |
| 1637 | + "gc: done, %zd unreachable, %zd uncollectable, %.4fs elapsed\n", |
| 1638 | + n+m, n, d); |
1636 | 1639 | } |
1637 | 1640 |
|
1638 | 1641 | // Clear the current thread's free-list again. |
|
0 commit comments