Boost logo

Boost Users :

Subject: Re: [Boost-users] Serialization newbie, memory being overwritten?
From: Nat Linden (nat_at_[hidden])
Date: 2012-11-27 11:23:17


Disclaimer: I haven't used the serialization library, nor have I
carefully read your code example.

I simply wonder whether your mental model of deserialization agrees
with that used by Boost.Serialization. I believe (!) that when
deserializing an object through a pointer, Boost.Serialization
allocates a new object before filling (some of) its fields from the
incoming data stream. You seem to expect Boost.Serialization to reuse
an existing object in memory instead. (I hadn't previously encountered
the phrase "partial serialization.")

I believe that in the typical use case addressed by
Boost.Serialization, the deserializing process has no direct access to
the memory data used by the serializing process. That might be because
the serializing process is shutting down for later resumption, or it
might be that the serializing process is running on a different
machine than the deserializing process. In either case, the only
object fields on which the deserializing process can rely are those
that were explicitly serialized and deserialized by your code. Put
differently, any fields you fail to de/serialize must be assumed to be
uninitialized.

You may have an unusual use case. If you can somehow pass some of the
fields of your memory object to the receiving process other than
through Boost.Serialization -- may we ask why not all of them? Why are
you using Boost.Serialization at all?

Apologies if I haven't properly understood your issue.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net