I am working in a GC sensitive environment, and am interested in serializing / deserializing protobuf from preallocated byte arrays instead of memory streams. Is this possible with the protobuf-net library?
You can initialise a MemoryStream
with a pre-allocated buffer, see this overload. You could probably go so far as to allocate one large buffer and index into bits of it using this overload.
You can then pass this stream to protobuf as usual.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With