-
Notifications
You must be signed in to change notification settings - Fork 120
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
calculate serialize size before serialization and serialize to pre-allocated memory #1048
Comments
Serializing to a pre-allocated buffer versus a dynamic buffer like Is there a reason why you can't reuse a A function to calculate the serialization size could be added, but it would need to iterate through your structures. This would actually add more overhead than simply reusing the |
Before if I use string I need to serialize to std::string then write it to shared memory, there is an extra copy. |
I see. I'll keep this issue alive to add the ability to compute the space required before serialization. I typically use shared libraries which allow me to share the std::string directly across processes, which allows dynamic buffer sharing and avoids the extra copy. But, I can see how if you are wanting to connect services in other programming languages it is easier to not have to deal with dynamic memory and just compute the size beforehand. |
thanks |
I am working on inter process communication base on shared memory and Unix Socket Domain recently, I plan to use glaze Beve to serialize my data.
I want calculate the object serialization size then alloc shared memory and write serialization data into it.
Is there some existing solution to do this. thanks.
The text was updated successfully, but these errors were encountered: