Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete ME after persisting them on disk #5650

Merged
merged 1 commit into from Oct 2, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions DQMServices/Core/interface/MonitorElement.h
Expand Up @@ -90,6 +90,8 @@ class MonitorElement
MonitorElement &operator=(const MonitorElement &);
~MonitorElement(void);

void deleteObjects(void);

/// Compare monitor elements, for ordering in sets.
bool operator<(const MonitorElement &x) const
{
Expand Down
16 changes: 8 additions & 8 deletions DQMServices/Core/src/DQMStore.cc
Expand Up @@ -2368,7 +2368,7 @@ void DQMStore::savePB(const std::string &filename,
const std::string &path /* = "" */,
const uint32_t run /* = 0 */,
const uint32_t lumi /* = 0 */,
const bool resetMEsAfterWriting /* = false */)
const bool deleteMEsAfterWriting /* = false */)
{
using google::protobuf::io::FileOutputStream;
using google::protobuf::io::GzipOutputStream;
Expand Down Expand Up @@ -2455,9 +2455,9 @@ void DQMStore::savePB(const std::string &filename,
delete toWrite;
}

//reset the ME just written to make it available for the next LS (online)
if (resetMEsAfterWriting)
const_cast<MonitorElement*>(&*mi)->Reset();
//delete the TH1 just written
if (deleteMEsAfterWriting && enableMultiThread_)
const_cast<MonitorElement*>(&*mi)->deleteObjects();
}
}

Expand Down Expand Up @@ -2496,7 +2496,7 @@ DQMStore::save(const std::string &filename,
SaveReferenceTag ref /* = SaveWithReference */,
int minStatus /* = dqm::qstatus::STATUS_OK */,
const std::string &fileupdate /* = RECREATE */,
const bool resetMEsAfterWriting /* = false */)
const bool deleteMEsAfterWriting /* = false */)
{
std::set<std::string>::iterator di, de;
MEMap::iterator mi, me = data_.end();
Expand Down Expand Up @@ -2669,9 +2669,9 @@ DQMStore::save(const std::string &filename,
if (mi->data_.flags & DQMNet::DQM_PROP_TAGGED)
TObjString(mi->tagLabelString().c_str()).Write();

//reset the ME just written to make it available for the next LS (online)
if(resetMEsAfterWriting)
const_cast<MonitorElement*>(&*mi)->Reset();
//delete the TH1 just written
if(deleteMEsAfterWriting && enableMultiThread_)
const_cast<MonitorElement*>(&*mi)->deleteObjects();
}
}

Expand Down
12 changes: 12 additions & 0 deletions DQMServices/Core/src/MonitorElement.cc
Expand Up @@ -229,6 +229,18 @@ MonitorElement::~MonitorElement(void)
delete refvalue_;
}

void
MonitorElement::deleteObjects(void)
{
delete object_;
delete reference_;
delete refvalue_;

object_ = nullptr;
reference_ = nullptr;
refvalue_ = nullptr;
}

//utility function to check the consistency of the axis labels
//taken from TH1::CheckBinLabels which is not public
bool
Expand Down