Skip to content

mark_sweep: trigger deferred collection for external allocations#53

Open
Flamki wants to merge 1 commit intoboa-dev:mainfrom
Flamki:fix/external-allocation-threshold-19
Open

mark_sweep: trigger deferred collection for external allocations#53
Flamki wants to merge 1 commit intoboa-dev:mainfrom
Flamki:fix/external-allocation-threshold-19

Conversation

@Flamki
Copy link
Contributor

@Flamki Flamki commented Mar 17, 2026

Closes #19

This keeps the fix narrowly scoped to mark-sweep allocation accounting.

What changed

  • In GcAllocator::allocate, after external/raw allocation via try_alloc_bytes(layout), we now check threshold state and set collect_needed when the heap is no longer below threshold.
  • Added regression test external_allocations_set_deferred_collection_flag_when_threshold_exceeded to verify large external allocations trigger deferred collection.

Why

External allocations were bypassing deferred-collection signaling, so threshold overflow from raw allocations could go unnoticed until later operations.

Scope

  • mark-sweep internals + tests only
  • no public API changes
  • no policy/threshold tuning changes

Validation

  • cargo fmt --all -- --check
  • cargo test --workspace
  • cargo clippy --workspace --all-features --all-targets
  • cargo clippy --workspace --no-default-features --all-targets
  • cargo doc -v --document-private-items --all-features
  • cargo +nightly miri test -p oscars --all-features

Copy link
Member

@nekevss nekevss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm, my one concern here is I believe the current plan is to remove the gc_allocator experiment.

See #54 for reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GcAllocator::allocate completely bypasses GC heap limits for external allocations

2 participants