Sorry for not getting back sooner, and thanks for the initial reply. I added a print to packed_archive_send, so it now looks like:
void
packed_archive_send(MPI_Comm comm, int dest, int tag,
const packed_oarchive& ar)
{
std::cout << "ar size: " << ar.size() << std::endl;
const void* size = &ar.size();
....
When I run this under release mode I with, I get:
ar size: 4265919640
MPI_Send: Invalid count, error stack:
MPI_Send(176): MPI_Send(buf=0x01E8AE18, count=-29047656, MPI_PACKED, dest=1, tag
=2147483647, MPI_COMM_WORLD) failed
MPI_Send(101): Negative count, value is -29047656
When I run it under debug mode, I don't get the error and
ar size: 1622.
Any suggestions how to proceed are much appreciated.