No, unfortunately C++ protobuf does not support custom allocators. The
closest you can get is to use Arena allocation
<https://developers.google.com/protocol-buffers/docs/reference/arenas> and
give your Arena an initial block of memory to use, but not everything will
be allocated on the arena. String and bytes fields use std::string, so
strings will end up stored on the heap.

On Sun, Aug 9, 2020 at 11:57 PM Gaurav Jain <[email protected]> wrote:

> Does protocol buffer supports allocating entries on custom allocator.
> Basically my requirement is to use PMEM as my extended DRAM. I am using
> libmemkind library for allocating/deallocating stuffs from PMEM.
> I have few protobuf objects on DRAM which I need to move to pmem using
> libmemkind.
> One way is to serialize these protobuf objects and copy raw bytes, but
> this will incur serialization and deserialization penalties. Is there a way
> to copy deserialized objects itself from DRAM to PMEM ? This can be doable
> if protobuf can support custom allocator while creating new objects.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/protobuf/cb56a2a7-75a1-4da5-925a-afbfdb3bb474n%40googlegroups.com
> <https://groups.google.com/d/msgid/protobuf/cb56a2a7-75a1-4da5-925a-afbfdb3bb474n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CADqAXr56%2Bv8WxmuZgsqgBpuBZ8ZSNvUvTSJNhA3F7_vkHVKpyw%40mail.gmail.com.

Reply via email to