Skip to content

mmap fails to preserve dimensions for zero length multi-dimensional arrays #44679

@ancapdev

Description

@ancapdev

Something like

mmap(io, Matrix{Float32}, (10, 0))

Will produce a matrix with zero size in all dimensions. I'm working with memory mapped data sets that may occasionally be empty, and I was expecting mmap to still preserve the non-zero dimensions I pass to it.

Source of the problem is here: https://github.com/JuliaLang/julia/blob/v1.7.2/stdlib/Mmap/src/Mmap.jl#L196

len == 0 && return Array{T}(undef, ntuple(x->0,Val(N)))

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrays[a, r, r, a, y, s]good first issueIndicates a good issue for first-time contributors to JuliastdlibJulia's standard library

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions