GeezerVison is showing github.com — Promote retained GC objects and batch generation updates by 1ndahous3 · Pull Request #8930 · RustPython/RustPython
Conversation
1ndahous3
commented
Oct 1, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
- Promote young survivors of a full collection to generation 2, so the next young collection does not revisit them.
- Promote resurrected objects and garbage retained by
DEBUG_SAVEALL to the next generation, capped at generation 2.
- Batch generation-list locking and atomic counter updates, releasing the locks between bounded batches.
Follow-up to #8902.
Performance
Windows 11 x64
Release build; median collection time, excluding heap construction.
| Collection |
Before |
After |
Speedup |
| Young generation, 2,000 live lists |
0.156 ms |
0.131 ms |
1.19× |
| Young generation, 20,000 live lists |
1.762 ms |
1.191 ms |
1.48× |
| Young generation with 2,000 new lists after a full collection of 20,000 retained lists |
1.520 ms |
0.144 ms |
10.58× |
AI assistance
Written with Codex (GPT-6), reviewed by a human before submission.
Summary by CodeRabbit
- Bug Fixes
- Objects that survive garbage collection are now assigned to the appropriate generation, including after a full collection.
- Resurrected objects and objects retained for debugging are promoted consistently, helping ensure they remain managed correctly in later collections.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Oct 1, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
🧰 Additional context used
📚 Code guidelines (1)
AGENTS.md — auto-discovered
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: RustPython/RustPython/.coderabbit.yml
Review profile: CHILL
Plan: Advanced
Run ID: dde749ad-14a1-45e6-b05c-6de633fc668c
📥 Commits
Reviewing files that changed from the base of the PR and between cb0f3b0 and ca8e09f.
📒 Files selected for processing (2)
crates/vm/src/gc_state.rs
extra_tests/snippets/stdlib_gc.py
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough
Garbage collection now promotes surviving objects to generation 2 during full collections. Resurrected and SAVEALL-retained objects are also promoted. Rust and Python tests cover generation placement and tracking consistency.
Changes
Garbage collector survivor promotion
| Layer / File(s) |
Summary |
Promotion targets and list updates crates/vm/src/gc_state.rs |
promote_survivors targets min(from_gen + 1, 2), processes survivors in batches, and updates counts for objects actually moved. A Rust test covers mixed generations, frozen and untracked objects, and list/count consistency. |
Retained-object promotion crates/vm/src/gc_state.rs, extra_tests/snippets/stdlib_gc.py |
Resurrected and SAVEALL-retained objects are promoted before retention. Python tests check generation placement for survivors and retained cycles after collections. |
Priority: ➖ Normal
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Suggested reviewers: youknowone
Merge Risk: ⚪ Minimal · up to ca8e0
This change promotes GC survivors to generation 2 and batches list updates, which should reduce young-collection cost. No concrete merge-blocking issue was identified, and tests cover generation placement and list consistency.
Security Architecture Review
Security architecture risk: 🔵 Low · up to ca8e0
The changes preserve ownership filtering and object-tracking checks. No introduced security vulnerability was identified, but shared object-lifetime transitions and concurrent execution have only source-level validation in this review.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
- inferred — The security-relevant failure domain is in-process object lifetime and shared generation-list integrity, potentially affecting interpreters sharing the process. The inspected changes do not expand filesystem, network, credential, or service authority.
Security Findings and Attack Paths
- inferred — User-created cycles, finalizers, and SAVEALL settings reach the changed promotion paths through existing collection behavior. The inspected transitions do not establish a new cross-owner exposure or object-lifetime attack path: ownership is preserved, references remain strong, and membership is rechecked under locks.
Trust Boundaries and Controls
- observed — Existing controls remain in place: collection is serialized with a collecting lock, generation selection is capped at 2, candidate selection filters ownership, and promotion holds both list locks while checking tracked status and moving each node. The new Heap and Drop code is confined to a regression test, not a production entrypoint.
Resilience and Maintainability Implications
- inferred — Repetition and stale snapshots are contained by tracked-state and generation rechecks; concurrent untracking retries if promotion changed the generation. Each successful move completes under both locks without invoking user callbacks. These mechanisms support lifetime and list-integrity guarantees, although arbitrary scheduling and interruption were not validated at runtime.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name |
Status |
Explanation |
Resolution |
| Docstring Coverage |
⚠️ Warning |
Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. |
Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
| Check name |
Status |
Explanation |
| Description Check |
✅ Passed |
Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check |
✅ Passed |
The title is concise, specific, and accurately summarizes the two main changes: promoting retained GC objects and batching generation updates. |
| Linked Issues check |
✅ Passed |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
✅ Passed |
Check skipped because no linked issues were found for this pull request. |
- Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Autopilot is currently an internal CodeRabbit preview.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|