comm: ExperimentData needs a virtual destructor

Classes deriving from ExperimentData usually contain the
experiment-specific Protobuf message, which needs to be properly
destroyed.  This is particularly a problem in the generic
DatabaseCampaign, as it never downcasts ExperimentData objects
retrieved from JobServer::getDone().  As the embedded
DatabaseCampaignMessage (usually named "fsppilot") is allocated on the
heap (this happens in the campaign's cb_send_pilot() function, asking
for a mutable_fsppilot()), the lack of a virtual destructor in
ExperimentData led to a memory leak, rendering the campaign server
inoperable after handling ~1E7 messages (with a 4GiB / 32-bit process
memory limit).

Change-Id: I4cb8a26d5a702e03189c4aae340051ce62a9c9ce
This commit is contained in:
Horst Schirmeier
2014-02-20 00:09:17 +01:00
parent 5ee96032c9
commit 5ccc6e3525

View File

@ -17,6 +17,7 @@ protected:
public:
ExperimentData() : msg(0), m_workloadID(0) {};
ExperimentData(google::protobuf::Message* m) : msg(m) , m_workloadID(0) { }
virtual ~ExperimentData() {}
google::protobuf::Message& getMessage() { return *msg; }
void setMessage(google::protobuf::Message *msg) { this->msg = msg; }