open(filename, "w+") do io
C = Mmap.mmap(io, BitArray, (64,10^3));
BinX = getHash(r.x)
for p=1:length(BinX)
C[p, 1] = parse(Int, BinX[p])
end
Mmap.sync!(C);
end
After I try to open or delete the created file, but I receive a message that the file is occupied by another program. How to close a file?
Most likely, C hasn’t been garbage collected. First make sure you’re not storing the return value somewhere (the fact that you need that semicolon means this block returns C to the caller). Then try calling GC.gc().
A runnable example might help (your example references lots of variables that we don’t have). Also details about your platform: Windows is quite different from Linux, for example.