Skip to content

Commit 0c173c9

Browse files
committed
wip: spelling fixes, minor code cleanup
1 parent 680f80f commit 0c173c9

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

Python/gc_free_threading.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "pycore_freelist.h" // _PyObject_ClearFreeLists()
88
#include "pycore_initconfig.h"
99
#include "pycore_interp.h" // PyInterpreterState.gc
10-
#include "pycore_time.h"
1110
#include "pycore_object.h"
1211
#include "pycore_object_alloc.h" // _PyObject_MallocWithType()
1312
#include "pycore_object_stack.h"
@@ -22,7 +21,7 @@
2221
// enable the "mark alive" pass of GC
2322
#define GC_ENABLE_MARK_ALIVE 1
2423

25-
// include addtional roots in "mark alive" pass
24+
// include additional roots in "mark alive" pass
2625
#define GC_MARK_ALIVE_EXTRA_ROOTS 1
2726

2827
// include Python stacks as set of known roots
@@ -482,7 +481,7 @@ mark_alive_stack_push(PyObject *op, _PyObjectStack *stack)
482481
}
483482

484483
// 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.
486485
gc_set_alive(op);
487486
if (_PyObjectStack_Push(stack, op) < 0) {
488487
_PyObjectStack_Clear(stack);
@@ -877,13 +876,17 @@ propagate_alive_bits(_PyObjectStack *stack)
877876
// Using tp_traverse, mark everything reachable from known root objects
878877
// (which must be non-garbage) as alive (_PyGC_BITS_ALIVE is set). In
879878
// 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.
887890
//
888891
// Returns -1 on failure (out of memory).
889892
static int
@@ -1631,8 +1634,8 @@ gc_collect_main(PyThreadState *tstate, int generation, _PyGC_Reason reason)
16311634
(void)PyTime_PerfCounterRaw(&t2);
16321635
double d = PyTime_AsSecondsDouble(t2 - t1);
16331636
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);
16361639
}
16371640

16381641
// Clear the current thread's free-list again.

0 commit comments

Comments
 (0)