简体   繁体   中英

Use specific allocator with Protocol Buffer in C++

Is it possible to specify an allocator for protocol buffer so that the memory allocated by PB behind my back is done using this allocator rather than new?

I haven't found any details about this in the documentation.

"... so that the memory allocated by PB behind my back is done using this allocator rather than new?"

I'm afraid there isn't such feature available, besides overriding the global new() implementation.

If you have problems regarding availability of dynamic memory management on your target, I'd recommend to use the nanopb generator and C-API. It's extremely lightweight, and doesn't need new() or other kind of dynamic memory management to use it at all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM