-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
ioInvolving the I/O subsystem: libuv, read, write, etc.Involving the I/O subsystem: libuv, read, write, etc.stdlibJulia's standard libraryJulia's standard librarysystem:windowsAffects only WindowsAffects only Windows
Description
using Mmap
fname = tempname()
write(fname, "bar")
function reading()
io = open(fname)
mm = Mmap.mmap(io)
q = view(mm, 1:2)
close(io)
end
reading()
isfile(fname) && rm(fname)
gives
ERROR: LoadError: IOError: unlink("C:\\Users\\nzimm\\AppData\\Local\\Temp\\jl_g1GveD8R03"): permission denied (EACCES)
Stacktrace:
[1] uv_error
@ .\libuv.jl:106 [inlined]
[2] unlink(p::String)
[1] uv_error
@ .\libuv.jl:106 [inlined]
[2] unlink(p::String)
@ .\libuv.jl:106 [inlined]
[2] unlink(p::String)
[2] unlink(p::String)
@ Base.Filesystem .\file.jl:1105
[3] rm(path::String; force::Bool, recursive::Bool)
@ Base.Filesystem .\file.jl:283
[4] rm(path::String)
@ Base.Filesystem .\file.jl:273
[5] top-level scope
@ C:\Users\nzimm\github\ZipArchives.jl\mmap.jl:16
in expression starting at C:\Users\nzimm\github\ZipArchives.jl\mmap.jl:16
Inserting GC.gc() between the call to reading() and the file deletion fixes the issue.
GC is an expensive call. Assuming mmap doesn't need everything GC does, can mmap (or close) do what ever is needed for itself so the GC call becomes unnecessary?
This issue is discussed in the Discourse here where it is reported that it doesn't arise in Linux.
Metadata
Metadata
Assignees
Labels
ioInvolving the I/O subsystem: libuv, read, write, etc.Involving the I/O subsystem: libuv, read, write, etc.stdlibJulia's standard libraryJulia's standard librarysystem:windowsAffects only WindowsAffects only Windows