JuliaLang/julia

Bug in heapsnapshot generation for arrays of inlined objects

Open

#61.396 aperta il 23 mar 2026

Vedi su GitHub
 (5 commenti) (0 reazioni) (0 assegnatari)Julia (5773 fork)batch import
GCgood first issueobservability

Metriche repository

Star
 (48.709 star)
Metriche merge PR
 (Merge medio 23g 11h) (145 PR mergiate in 30 g)

Descrizione

Given an array like this:

julia> m = Memory{Pair{Any,Any}}([Pair{Any,Any}(1, 2), Pair{Any,Any}(3, 4)])
2-element Memory{Pair{Any, Any}}:
 1 => 2
 3 => 4

We will end up generating multiple lines with duplicate keys, which is not correct:

Src, Idx, Dst
  m,   1,   1
  m,   1,   2
  m,   2,   3
  m,   2,   4

Probably the right fix is to generate something like this instead:

Src,  Name, Dst
  m, [1].x,   1
  m, [1].y,   2
  m, [2].x,   3
  m, [2].y,   4

This would be fixed in the C++ code for generating the heapsnapshot, https://github.com/JuliaLang/julia/blob/8493b13f44455a5f16f1f830c223845a3dacf2c8/src/gc-heap-snapshot.cpp#L533-L537, and in the GC code that marks those edges, e.g. here: https://github.com/JuliaLang/julia/blob/8493b13f44455a5f16f1f830c223845a3dacf2c8/src/gc-stock.c#L2865-L2869

Guida contributor