GH-126491: GC: Mark objects reachable from roots before doing cycle collection (GH-127110)

* Mark almost all reachable objects before doing collection phase

* Add stats for objects marked

* Visit new frames before each increment

* Update docs

* Clearer calculation of work to do.
This commit is contained in:
Mark Shannon 2024-12-02 10:12:17 +00:00 committed by GitHub
parent 2a373da770
commit a8dd821d5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 365 additions and 113 deletions

View file

@ -1118,6 +1118,8 @@ def gc_stats_section() -> Section:
Count(gen["collections"]),
Count(gen["objects collected"]),
Count(gen["object visits"]),
Count(gen["objects reachable from roots"]),
Count(gen["objects not reachable from roots"]),
)
for (i, gen) in enumerate(gc_stats)
]
@ -1127,7 +1129,8 @@ def gc_stats_section() -> Section:
"GC collections and effectiveness",
[
Table(
("Generation:", "Collections:", "Objects collected:", "Object visits:"),
("Generation:", "Collections:", "Objects collected:", "Object visits:",
"Reachable from roots:", "Not reachable from roots:"),
calc_gc_stats,
)
],