Skip to content

High peak memory usage when writing large matrices #337

@HinanaV

Description

@HinanaV

Hello!
When writing a large dataset(580k * 21) to a new .xlsx file using XLSX.jl in mode="w", peak memory usage becomes extremely high (≈ 20GB in my case) . This happens even without rw editing.

using JLD2, Random

nrow = 580_000
ncol = 21
Random.seed!(123)
X = rand(Float32, nrow, ncol)
jldsave("X_580k_21.jld2", true; X)
println("saved: X_580k_21.jld2")
using XLSX, JLD2

T = JLD2.load("X_580k_21.jld2")
XLSX.openxlsx("mem_test.xlsx", mode="w") do xf
    sh = xf[1]
    sh["A1"] = T["X"]
end

My source data is stored in JLD2 and is relatively small (580_000 × 21 × 4 bytes = 48,720,000 bytes ≈ 46.5 MiB).
The resulting XLSX file is around 151 MB on disk after saving.

Julia 1.9.3
Windows11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions