julia
8481162d - alloc-opt: Keep references stored after `gc_preserve_begin` rooted

Commit
17 hours ago
alloc-opt: Keep references stored after `gc_preserve_begin` rooted When an allocation is split into stack slots, a `gc_preserve_begin` on it is rewritten to preserve the values its reference fields hold at that point. A reference stored into the object later in the preserve region was therefore not rooted, so e.g. the keys of an `IdDict` filled inside `GC.@preserve dict` could be collected. Leave the allocation on the heap when a write to a reference field is reachable from a `gc_preserve_begin` using it. This surfaced as memory corruption in PATHSolver.jl, which roots its callback data that way, and is reachable since #61131. Assisted-by: Claude Code (Fable 5.2)
Author
Committer
Parents
Loading