Skip to content

using SparseArrays makes vcat'ing adjoint vectors memory hog, regression in Julia 1.10 beta #51011

@jaakkor2

Description

@jaakkor2
using SparseArrays
a=[rand(2) for i=1:30000];
vcat(a'...)

EDIT: using SparseArrays that gets loaded by using Statistics

gives

ERROR: StackOverflowError:
Stacktrace:
 [1] _cat_size_shape(::Tuple{…}, ::Tuple{…}, ::LinearAlgebra.Adjoint{…}, ::LinearAlgebra.Adjoint{…}, ::Vararg{…}) (repeats 15353 times)
   @ Base .\abstractarray.jl:1748
 [2] cat_size_shape(::Tuple{…}, ::LinearAlgebra.Adjoint{…}, ::LinearAlgebra.Adjoint{…}, ::Vararg{…})
   @ Base .\abstractarray.jl:1746
 [3] _cat_t(::Val{1}, ::Type{Float64}, ::LinearAlgebra.Adjoint{Float64, Vector{Float64}}, ::Vararg{LinearAlgebra.Adjoint{Float64, Vector{…}}})
   @ Base .\abstractarray.jl:1787
 [4] _cat(::Val{1}, ::LinearAlgebra.Adjoint{Float64, Vector{Float64}}, ::Vararg{LinearAlgebra.Adjoint{Float64, Vector{Float64}}})
   @ SparseArrays C:\Users\jaakkor2\.julia\juliaup\julia-1.10.0-beta2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\SparseArrays\src\sparsevector.jl:1221
 [5] cat(::LinearAlgebra.Adjoint{Float64, Vector{Float64}}, ::Vararg{LinearAlgebra.Adjoint{Float64, Vector{Float64}}}; dims::Val{1})
   @ Base .\abstractarray.jl:1981
 [6] vcat(::LinearAlgebra.Adjoint{…}, ::LinearAlgebra.Adjoint{…}, ::LinearAlgebra.Adjoint{…}, ::Vararg{…})
   @ SparseArrays C:\Users\jaakkor2\.julia\juliaup\julia-1.10.0-beta2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\SparseArrays\src\sparsevector.jl:1233
Some type information was truncated. Use `show(err)` to see complete types.

The example works on Julia 1.9.

On Julia 1.10 both collect(hcat(a...)') and stack(a, dims=1) work ok, latter requires Julia ≥ 1.9.

julia> versioninfo()
Julia Version 1.10.0-beta2
Commit a468aa198d (2023-08-17 06:27 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 20 × 13th Gen Intel(R) Core(TM) i7-1370P
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, goldmont)
  Threads: 1 on 20 virtual cores

Julia from juliaup, started with julia +beta --startup-file=no

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorperformanceMust go fasterregressionRegression in behavior compared to a previous version

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions