Since you opened the file with read-only access ("r" instead of "r+"),
attempting to write to the file (through the mmap array) is an error.
On Thu, Apr 9, 2015 at 9:15 AM Maco Anshu <[email protected]> wrote:> Hi, > I am trying to reproduce an algorithm http://arxiv.org/abs/1312.5542 in > Julia. Since the array for which I want to find the Principle Components > for is huge, I would need to use it as a memory mapped as many discussions > in the mailing list point out. > However when I try to perform any set operation on mmap_array I get an > error. Its a different error on Windows/Linux. My question is whether the > mmap_array implementation is read-only or is it some mistake in my usage ? > > julia> s = open("data","r") > IOStream(<file data>) > > julia> A = mmap_array(Float64,(4,5),s) > 4x5 Array{Float64,2}: > 1.97626e-323 0.0 0.0 0.0 0.0 > 2.47033e-323 0.0 0.0 0.0 0.0 > 0.0 0.0 0.0 0.0 0.0 > 0.0 0.0 0.0 0.0 0.0 > > julia> A[2,3] > 0.0 > > julia> A[2,3] = 5.6 > ERROR: MemoryError() > in setindex! at array.jl:308 > > One thread here points to close s before I use mmap_array so I tried that > too > > julia> close(s) > > julia> A[2,3] = 5.6 > ERROR: MemoryError() > in setindex! at array.jl:308 > > Thanks a lot, > Maco >
