Skip to content
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

Merged
merged 3 commits into from
Jul 8, 2013
Merged

RFC: support mmap on Windows #3603

merged 3 commits into from
Jul 8, 2013

Conversation

timholy
Copy link
Sponsor Member

@timholy timholy commented Jul 2, 2013

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.

@timholy timholy mentioned this pull request Jul 2, 2013
@timholy
Copy link
Sponsor Member Author

timholy commented Jul 2, 2013

I should mention that I deprecated the "easy" version of msync with flags because the Windows analog doesn't accept them. You can still call it that way on Unix by explicitly taking the pointer.

@StefanKarpinski
Copy link
Sponsor Member

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))
Copy link
Member

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.

Copy link
Sponsor Member

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.

Copy link
Sponsor Member Author

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.

@timholy
Copy link
Sponsor Member Author

timholy commented Jul 3, 2013

I discovered a sneaky way to test it (sortof) on the latest Windows binary:

eval(Base, :(include("mmap.jl")))

I had to hack isreadonly (because that functionality depends on some changes to ios, for example), so I only tested reading. Found a couple of issues, naturally, and fixed them. Now I can say that this seems to work, as far as I was able to ascertain.

Keno added a commit that referenced this pull request Jul 8, 2013
RFC: support mmap on Windows
@Keno Keno merged commit 4d231fb into JuliaLang:master Jul 8, 2013
@Keno
Copy link
Member

Keno commented Jul 8, 2013

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?

@simonster
Copy link
Member

See also #3434

KristofferC pushed a commit that referenced this pull request Sep 5, 2023
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants