From 62ac172f2bcfc2c43218c3839016960b36a27a94 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Mon, 28 Oct 2019 23:29:46 -0400 Subject: [PATCH] fix #33675, unpredictable `summarysize` on isbitsunion arrays --- base/summarysize.jl | 2 +- test/misc.jl | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/base/summarysize.jl b/base/summarysize.jl index 714b60ed8dfea..69aa791669b66 100644 --- a/base/summarysize.jl +++ b/base/summarysize.jl @@ -125,7 +125,7 @@ function (ss::SummarySize)(obj::Array) dsize += length(obj) end size += dsize - if !isbitstype(eltype(obj)) && !isempty(obj) + if !isempty(obj) && !Base.allocatedinline(eltype(obj)) push!(ss.frontier_x, obj) push!(ss.frontier_i, 1) end diff --git a/test/misc.jl b/test/misc.jl index 8b5afee2719af..09c85b97302de 100644 --- a/test/misc.jl +++ b/test/misc.jl @@ -206,6 +206,11 @@ end @test summarysize(Vector{Nothing}(undef, 16)) == summarysize(Vector{Nothing}(undef, 32)) @test summarysize(S32881()) == sizeof(Int) +# issue #33675 +let vec = vcat(missing, ones(100000)) + @test length(unique(summarysize(vec) for i = 1:20)) == 1 +end + # issue #13021 let ex = try Main.x13021 = 0