-
Notifications
You must be signed in to change notification settings - Fork 225
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
Is no-copy message write possible with no alloc ? #535
Comments
Hm... capnproto-rust/capnp/src/message.rs Lines 534 to 538 in 1ec4709
However, that method calls deallocate_all() capnproto-rust/capnp/src/private/arena.rs Lines 320 to 325 in 1ec4709
... which causes the buffer to be zeroed: capnproto-rust/capnp/src/message.rs Lines 975 to 989 in 1ec4709
Note that dropping the capnproto-rust/capnp/src/private/arena.rs Lines 460 to 467 in 1ec4709
So perhaps we should add a version of The segment table for these messages will always have only one word. So your process could look like this:
You should be able to make this work by writing your own version of |
Thanks so much for quick response ! I didn't even notice the deallocate part happening yet. And yep - with these pointers it looks like i should certainly be able to hack something to work here. |
The You'll also want to make sure that You might also consider not bothering with segment tables, if all the messages you will be dealing with are single-segment and you have some other means of knowing their lengths. |
Hey, here's the basic test code i have to create a message in a slice:
The question is, is it possible to, even in theory, to write a message without having a copy in an intermediate buffer ? I couldn't figure it out.
By reading the code, it doesn't currently seem possible, as
write_segment_table
needs to write 8 bytes to the head of the buffer - after the message has been constructed. Andwrite_segment_table
is not public, so i can't manually partition the slice for writing the single-segment header and the message.The text was updated successfully, but these errors were encountered: