The problem here is not actually the referencing or the memory. Your code is fine. It’s the fact that Julia’s compiler handles large immutable struct like tuples very badly. So badly in fact that large structs are unusable in Julia.
Hopefully this will be adressed in the future - it’s certainly something I’ve seen mentioned many times, and is an annoying limitation to Julia.
For now, the solution is to limit the size of immutable structs to, say, 100 fields, and use heap-allocated vectors instead, i.e. Vector{UInt8}
.
2 Likes