Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stdlib/Mmap/src/Mmap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ function mmap(io::IO,
end # os-test
# convert mmapped region to Julia Array at `ptr + (offset - offset_page)` since file was mapped at offset_page
A = unsafe_wrap(Array, convert(Ptr{T}, UInt(ptr) + UInt(offset - offset_page)), dims)
finalizer(A) do x
finalizer(A.ref.mem) do x
@static if Sys.isunix()
systemerror("munmap", ccall(:munmap, Cint, (Ptr{Cvoid}, Int), ptr, mmaplen) != 0)
else
Expand Down
7 changes: 4 additions & 3 deletions stdlib/Mmap/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ if !(Sys.ARCH === :powerpc64le || Sys.ARCH === :ppc64le)
s = open(file, "r")
m = mmap(s)
@test_throws ReadOnlyMemoryError m[5] = UInt8('x') # tries to setindex! on read-only array
finalize(m); m=nothing; GC.gc()
finalize(m); m=nothing;
end

GC.gc()
write(file, "Hello World\n")

s = open(file, "r")
Expand Down Expand Up @@ -336,8 +336,9 @@ open(file, "r+") do s
finalize(A); A = nothing; GC.gc()
A = mmap(s, Vector{UInt8}, (10,), 1)
Mmap.sync!(A)
finalize(A); A = nothing; GC.gc()
finalize(A); A = nothing;
end
GC.gc()
rm(file)

@testset "Docstrings" begin
Expand Down