When used for serialize the shared pointer, memory leak occurs.
I am not sure that is due to the internal bug or the wrong use of
serialization library.
The following is test code:
============================================================================
======
#include <iostream>
#include <cstddef>
#include <fstream>
#include <string>
#include <cstdio>
#include
#include
#include
#include
#include
class A{
private:
friend class boost::serialization::access;
int x;
template<class Archive>
void serialize(Archive& ar, const unsigned int /* file version */)
{
ar & x;
}
public:
static int count;
A(){++count; std::cout<<"A ctor"<> spa;
}
spa.reset();
std::cout << std::endl;
return 0;
}
============================================================================
======
The output is:
A ctor
A dtor
A ctor
Valgrind report memory leak of 8 bytes, just the size of class A.