-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: support mmap on Windows #3603
Conversation
I should mention that I deprecated the "easy" version of |
Thanks, Tim! @loladiro and @vtjnash should review, of course. |
|
||
msync{T}(A::Array{T}) = msync(pointer(A), length(A)*sizeof(T)) | ||
|
||
munmap{T}(A::Array{T}) = munmap(pointer(A), length(A)*sizeof(T)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit of a foot gun, no? After munmap(A)
, doing anything at all with A
will cause Julia to segfault.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. It might be better to only munmap in the finalizer. Forcing a GC to munmap something is a bit awkward though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
munmap
does get called in the finalizer. Perhaps we shouldn't export it, though, or provide an interface beyond the pointer-based one. I'll change that.
I discovered a sneaky way to test it (sortof) on the latest Windows binary:
I had to hack |
Thanks Tim, this is great to have. One concern that bothers me is that you'll get a segfault when trying to write to a mmap'ed region that is declared as read-only. Though I am not really sure what to do about that. @JeffBezanson any ideas? |
See also #3434 |
Stdlib: Pkg URL: https://github.com/JuliaLang/Pkg.jl.git Stdlib branch: master Julia branch: master Old commit: 047734e4c New commit: f570abd39 Julia version: 1.11.0-DEV Pkg version: 1.11.0 Bump invoked by: @KristofferC Powered by: [BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl) Diff: JuliaLang/Pkg.jl@047734e...f570abd ``` $ git log --oneline 047734e4c..f570abd39 f570abd39 tweak how Pkg is loaded for precompiling when testing (#3606) d3bd38b90 sort compat entries in `pkg> compat` (#3605) 5e07cfed0 Ensure that `string(::VersionSpec)` is compatible with `semver_spec()` (#3580) 6bed7c41a Clarify handling of LOAD_PATH in docstring and REPL help (#3589) 5261b3be7 tweak test dep docs (#3574) 72b430d50 status: expand 2 symbol upgrade note to highlight *may* be upgradable (#3576) b32db473d precompile: show ext parent in output report (#3603) ``` Co-authored-by: Dilum Aluthge <dilum@aluthge.com>
I don't have a build environment set up for Windows, so I haven't tested this directly. However, I tested the "ingredients" successfully in a standalone file, so the odds are not entirely zero for this working. However, if it's not practical for anyone else to test this, I can (with some time) give that a try.
It does pass tests on Linux; I should mention that I have seen some test failures, but they don't seem to be consistent, and I got this to pass testall three times in a row before submitting.