-
Notifications
You must be signed in to change notification settings - Fork 72
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
Documentation of safety invariants #16
Comments
#13 ? |
I appreciate the blurb, but is there any way to give us slightly stronger guarantees? E.g., if we memory map disjoint regions of the same file are we guaranteed that they will never directly interfere with one another (I'm not worried about out of process behavior, just in process, with two completely different async tasks writing to disjoint regions of the same file)? |
That's the problem. We cannot guarantee that. |
Sure, I understand that. I have unrelated mechanisms that (should) protect against that kind of problem. However, I don't know if my using memmap on the same file handle within the same process, but on different threads and to disjoint regions of the file is by itself unsafe. Do you know if that action itself will cause UB? |
Sadly, no idea. I'm using memmap in a very trivial way and I'm not aware of possible edge cases. |
Got it. OK, I'll have to think up some other way to handle my use case then. Thank you for your quick replies! |
A memory map provides you with an instance of That said, |
Thank you @adamreichold, that's exactly what I needed to know! Within my own process space, I can guarantee that instances of
That is a harder nut for me to crack. My goal is write an extremely fast serializer/deserializer similar in spirit to abomonation, but which is somewhat safer to use, correctly deals with cycles in object graphs, and whose serialized contents can be passed around between different platforms which may have different page sizes. That is a long-winded way of saying that I can't easily align to any given page size, as what works on one platform may not work on another. Do you know if being misaligned would cause any correctness issues? I can figure out a way around the speed problem, as long as the result is always correct. |
I am not sure we are talking about the same thing? I was suggest to restructure things so that there is only one instance of the
Sorry, but I really do not know and hence would work on the assumption that it does. |
You're right that we weren't talking about the same thing originally, but I may be able to restructure what I want to do so that it fits in with what you're suggesting. My original plan was that I could have an arbitrarily large archive file, and multiple disjoint views on the file that are I'll work on restructuring my design, probably with lots of much smaller files. That will ensure that the file handles are to entirely separate objects, with at most on |
MmapMut::map_mut
is anunsafe
function, but there is not any documentation about why it isunsafe
and which invariants the user have to hold.The text was updated successfully, but these errors were encountered: