JuliaLang/julia

Bug in heapsnapshot generation for arrays of inlined objects

Open

#61 396 ouverte le 23 mars 2026

Voir sur GitHub
 (5 commentaires) (0 réactions) (0 assignés)Julia (5 773 forks)batch import
GCgood first issueobservability

Métriques du dépôt

Stars
 (48 709 stars)
Métriques de merge PR
 (Merge moyen 23j 11h) (145 PRs mergées en 30 j)

Description

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

Guide contributeur