This surprised me:

immutable A
  a::UInt32
  b::UInt32
  c::UInt64
  d::UInt64
end

sizeof(A[A(0,0,0,0), A(0,0,0,0)]) # 48

immutable B
  a::UInt32
  b::UInt32
  c::Vector{UInt64}
  d::Vector{UInt64}
end

sizeof(B[B(0,0,[],[]), B(0,0,[],[])]) # 16

I expected the latter to also have size 48 ie 2xInt32, 2xPointer. Are
only transitively immutable types stored inline? Is this documented
anywhere?

Reply via email to