JLD2.jl
JLD2.jl copied to clipboard
JLD2 writes zeros to first 3440 bytes in file
When writing arrays or other structures to a JLD2 file, it writes zeros to the first 3440 bytes in the file. Here is a sample code:
using JLD2
tmp = ones(Float64, 100, 100, 100)
jldsave("test.jld2"; tmp)
aa = load("test.jld2")["tmp"]
Then the read array aa
will be zeros until element 431 (first 3440 bytes). If I instead write a Float32 array, then it is zero until element 861 (still first 3440 bytes).
This error persists if I write different structures with arrays. The array parts of the structure have also the first elements filled with zeros. There is no difference whether using the FileIO
interface or jldsave
.
Using Julia 1.10.0, JLD2 0.4.43 on Linux. The error only happens in Linux. Tested with a M1 Mac with Julia ARMv8 for and it worked fine.