Skip to content

sizeof returns erroneous results for Union arrays #23321

@iamed2

Description

@iamed2
julia> v = Union{Int,Void}[rand(Bool) ? k : nothing for k = 1:10]
10-element Array{Union{Void, Int64},1}:
   nothing
  2
  3
   nothing
   nothing
   nothing
   nothing
  8
  9
 10

julia> sizeof(v)
1762099360

Based on multiple Julia sessions, the number appears to be some random integer multiplied by the length of the array. A fresh Julia session is more likely to result in 0 so it seems like it's probably accessing the wrong memory somewhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrays[a, r, r, a, y, s]

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions