-
Notifications
You must be signed in to change notification settings - Fork 184
Add address option to MMapOptions #85
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
base: master
Are you sure you want to change the base?
Conversation
|
Woops, forgot how making pull requests from the commandline worked :P |
|
Hi @tinco, AFAIK this isn't something that can be done reliably across platform, and as such it isn't something I want to support in this crate. In particular the behavior around what happens when the address is already in use by the process differs, e.g. on windows:
Meanwhile If you can find a way to make the behavior across platforms consistent then I'd be open to consideration. At a minimum, though, I think this new method would need to be marked |
|
Hey Dan! Thanks for looking at the PR :) I had not thought about overwriting existing mappings, it makes sense and I wouldn't mind at all making it be marked unsafe. I think that implies it should be done through a separate method, so not through MMapOptions then. The data structure I'm trying to implement is actually ported from the Golang memory allocator, it has implementations of this exact thing for all manner of platforms including various unix flavours and windows. It uses I'll take a look later and see if I can make it be truly cross platform. |
|
Any progress on this? I would love to use this feature instead of shoe-horning my own (bad) version of this awesome library. |
|
Hey! I moved my attention to another part of my code but I definitely want to continue on this, I'll have another look this weekend. |
|
@danburkert Would you consider platform specific functions behind a feature flag? I too need the |
|
@danburkert this is also something we would be interested in (allocating at a fixed address). Initially, we could just have an address option that specifies at which virtual address a region will be mapped (but doesn't allow growing/overwriting allocations). This can be done completely cross-platform, and wouldn't need to be A second (platform-specific option) would be to overwrite an existing memory mappings. This would require more work (i.e. changing to virtual alloc). |
Hi, I'm implementing a memory allocator in Rust (porting the one from Go) and one requisite is being able to grow a specific mmap'ed vector without reallocating (for lockless purposes). Would be cool if I could use your crate for this, so I added this feature to it. I made an attempt at implementing the functionality for Windows as well, but I've no Windows box at my office so I haven't tested it. If you like the feature I'll make a better attempt at documenting and perhaps adding some tests.