Boost logo

Boost Users :

Subject: [Boost-users] Problems with (de)serialization from/through pointer to base class
From: Rafael Arco Arredondo (rafaarco_at_[hidden])
Date: 2011-10-21 18:37:40


I am encountering problems with boost::serialization, particularly when objects are sent with boost::mpi and contain pointers to a base class. I am getting segmentation faults, but not always, only when the transmitted objects exceed a particular size.

I have two abstract classes, A and B, two instantiable classes, D and E, and a fifth class C, which is the class eventually serialized and contains one pointer to an object of class A and another to an object of class B.

In the example attached, when n (which determines the size of E objects) is 1000, everything works fine. If, for instance, n=2000, the segmentation fault appears when the object is deserialized after calling comm.recv. The output for this last case is also attached in file output.log. I am also using boost::shared_ptr as well to wrap class C objects, but the error is also thrown when no shared pointers are used.

When types and object sizes are known a priori there are no problems, but I would need something more general and dynamic right now. It is possible to do this, isn't it?

Any ideas of what is happening? Am I doing something wrong? Did I miss something in the documentation? Is there any size limitation for serializing/deserializing objects? I imagine MPI_Unpack, which appears in the stack trace, is restricted by the size of the input buffer, indicated by an int, but I believe this is not the problem here. Is it perhaps a bug? Any help or comments will be appreciated.

Thank you in advance,


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at