Skip to content

ThreadState: custom Collect impl to drop dead stack slots #43

@xacrimon

Description

@xacrimon

`ThreadState.stack` is a `Vec<Value<'gc>>` that the derived `Collect` impl traces in full. Slots between the live frames' top-of-stack and `stack.len()` may still hold last-call leftovers, which keeps those values reachable and prevents the GC from reclaiming them.

`src/env/thread.rs:40` flags this. Fix is a hand-written `Collect` impl that only traces slots up to the maximum live frame extent (or proactively clears slots when frames pop).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/gcDMM garbage collectorarea/vmVM interpreter and dispatchoptimizationPerformance / bytecode densitypriority/lowPolish / nice to have

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions