Sachin Kumar
2018-01-31 05:44:27 UTC
Hi,
I'm trying to use MallocMessageBuilder that's backed by a fixed size chunk
of mmap'ed memory. So, in pseudo-code:
char* buf = claim_mmap_memory(1024);
::capnp::MallocMessageBuilder message(buf);
... build message
The questions I have:
1) Am I correct in trying to do this with MallocMessageBuilder given that
the memory claimed is fixed size (1024 bytes in the above example). I can
generally assume that the message should *not* exceed 1024 -- perhaps I can
programmatically check the size used as the message is built and throw an
exception if it exceeds 1024?
2) Is it efficient to instance a malloc message builder like this in a
tight loop repeatedly to send many messages?
3) How do I convert the raw char* buffer into a kj::ArrayPtr<word> so that
I can pass into the constructor of MallocMessageBuilder?
Thanks,
Sachin
I'm trying to use MallocMessageBuilder that's backed by a fixed size chunk
of mmap'ed memory. So, in pseudo-code:
char* buf = claim_mmap_memory(1024);
::capnp::MallocMessageBuilder message(buf);
... build message
The questions I have:
1) Am I correct in trying to do this with MallocMessageBuilder given that
the memory claimed is fixed size (1024 bytes in the above example). I can
generally assume that the message should *not* exceed 1024 -- perhaps I can
programmatically check the size used as the message is built and throw an
exception if it exceeds 1024?
2) Is it efficient to instance a malloc message builder like this in a
tight loop repeatedly to send many messages?
3) How do I convert the raw char* buffer into a kj::ArrayPtr<word> so that
I can pass into the constructor of MallocMessageBuilder?
Thanks,
Sachin
--
You received this message because you are subscribed to the Google Groups "Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capnproto+***@googlegroups.com.
Visit this group at https://groups.google.com/group/capnproto.
You received this message because you are subscribed to the Google Groups "Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capnproto+***@googlegroups.com.
Visit this group at https://groups.google.com/group/capnproto.