Skip to content

Base.summarysize returns different memory usage values on different runs #53061

@Tortar

Description

@Tortar

MWE:

mutable struct B
    x::Union{Float64, Tuple{Float64, Float64}}
    y::Union{Float64, Tuple{Float64, Float64}}
end

ex = B[B(rand(), (rand(),rand())) for _ in 1:10^5];

now if you execute:

julia> Base.summarysize(ex)
7776776

julia> Base.summarysize(ex)
7820648

julia> Base.summarysize(ex)
7923000

julia> Base.summarysize(ex)
7911824

This can become very extreme in some situation, I saw a 2x difference between runs on a more complex vector of structs.

Tested in 1.10 and nightly, same behaviour

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueIndicates a good issue for first-time contributors to Juliaobservabilitymetrics, timing, understandability, reflection, logging, ...

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions