Opened 15 years ago
Closed 15 years ago
#1137 closed Bugs (fixed)
Virtual destructor is missing
| Reported by: | anonymous | Owned by: | Robert Ramey |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | serialization |
| Version: | Boost 1.34.1 | Severity: | Problem |
| Keywords: | polymorphic archive destructor | Cc: | Robert Ramey |
Description
The destructor of polymorphic_xml_oarchive gets never called when deleted through polymorphic_oarchive. I posted this to the users list and Robert Ramey already had a solution but it seems to not have made it into 1.34.1 :-(
The result of this is a memory leak and a missing </boost_serialization> tag at the end of the stringstream in the following example:
#include <iostream>
#include <sstream>
#include <boost/archive/polymorphic_oarchive.hpp>
#include <boost/archive/polymorphic_xml_oarchive.hpp>
void main(int argc, char** argv)
{
std::ostringstream buffer;
boost::archive::polymorphic_oarchive* archive_interface;
archive_interface = new boost::archive::polymorphic_xml_oarchive(buffer);
delete archive_interface;
buffer.flush();
std::cout << buffer.str();
}
Note:
See TracTickets
for help on using tickets.
