Skip to content

Instantly share code, notes, and snippets.

@carlobaldassi
Created July 24, 2018 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlobaldassi/0467d469f2c7de5bcf5c32f686ea0818 to your computer and use it in GitHub Desktop.
Save carlobaldassi/0467d469f2c7de5bcf5c32f686ea0818 to your computer and use it in GitHub Desktop.
scripts to reproduce JLD issues on julia 0.7
module Tst
using JLD
GC.gc()
Aarray = Vector{Float64}[[1.2,3.4],[1.1]]
str = "abc"
stringsA = ["x","y","z"]
strings16 = convert(Vector{JLD.UTF16String}, stringsA)
bigdata = [1:10000;]
fn = "tst.tmp.jld"
fid = jldopen(fn, "w")
write(fid, "Aarray", Aarray)
write(fid, "str", str)
write(fid, "stringsA", stringsA)
write(fid, "stringsU", stringsA)
write(fid, "strings16", strings16)
write(fid, "bigdata", bigdata)
close(fid)
fidr = jldopen(fn, "r", mmaparrays=true)
try
read(fidr, "bigdata") == bigdata
finally
close(fidr)
end
GC.gc()
end # module
module Tst2
using JLD
GC.gc()
struct BitsUnion
x::Union{Int64, Float64}
end
bitsunion = BitsUnion(5.0)
fn = "tst.tmp.jld"
fid = jldopen(fn, "w")
write(fid, "bitsunion", bitsunion)
close(fid)
fidr = jldopen(fn, "r", mmaparrays=true)
try
read(fidr, "bitsunion") == bitsunion
finally
close(fidr)
end
GC.gc()
end # module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment