Skip to content

Base.summarysize not properly accounting for Vectors containing certain types #40773

Closed

Description

Hey all. On Julia 1.5.3:

julia> versioninfo()
Julia Version 1.5.3
Commit 788b2c77c1 (2020-11-09 13:37 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 

it seems that Base.summarysize doesn't recurse deeply enough for Vectors containing Sets (as well as for our own user-defined type).

julia> s = Set(1:100)
Set{Int64} with 100 elements:
  2
  89
  11
  29
  74
  57
  31
  78
  70
  33
  96
   
julia> c = [s]
1-element Array{Set{Int64},1}:
 Set([2, 89, 11, 29, 74, 57, 31, 78, 70, 33    19, 51, 22, 6, 24, 73, 53, 23, 27, 56])
julia> Base.summarysize(c)
48
julia> Base.summarysize(s)
4800

Array{Array{Int64}}, Array{Dict{Int64,Int64}}, and a few other permutations seem to work fine.

I dug a little bit and I think this has something to do with it and is preventing the function from accessing the set:

julia> Base.allocatedinline(Dict{Int,Int})
false

julia> Base.allocatedinline(Vector{Int})
false

julia> Base.allocatedinline(Set{Int})
true

which is defined here

allocatedinline(T::Type) = (@_pure_meta; ccall(:jl_stored_inline, Cint, (Any,), T) != Cint(0))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions