I am using multiple inheritance with boost serialization. instead of doing
boost::serialization::base_object< Connection<T> >(*this)
boost::serialization::base_object< Collection<C> >(*this)
I am doing
template<typename ArchiveT>
void save(ArchiveT& arc, const unsigned version) const{
//both Connection<T> and Collection<C> are Base Classes
Connection<T>::save(arc, version);
Collection<C>::save(arc, version);
}
and its working. So is two of them the same thing ? or there is any harm in doing this ? should I change this code ?
{This thing was coded long ago. So I forgot Why I coded it in that way. may be I was not aware of base_object at that time}
I am serializing huge set of data (~1.6 GB) .When I serialize I see serialization process is taking a lot of memory and hitting 3GB barrier. I’ve tried commenting serialization code and it takes < 50MB memory . So what makes serialization taking that big memory ?
You should change your code and serialize the base classes through
base_object<>().From the documentation:
The extra memory consumption is probably caused by object tracking.
If you have a large quantity of objects being tracked, the memory consumption can increase drastically during serialization.
From special considerations:
If you don’t require object tracking, you may disable it with: