Skip to content

Commit

Permalink
Fix memory use when writing ParameterSets to files
Browse files Browse the repository at this point in the history
When forwarding a VPSet from the input file to the output, avoid
calling vpset() which triggers creating the entire vector.
  • Loading branch information
Dr15Jones committed Apr 15, 2024
1 parent 334bb70 commit bdfd19d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion FWCore/ParameterSet/src/ParameterSet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ namespace edm {
if (useAll || b->second.isTracked()) {
size += 2;
size += b->first.size();
size += sizeof(ParameterSetID) * b->second.vpset().size();
size += sizeof(ParameterSetID) * b->second.size();
}
}

Expand Down
4 changes: 3 additions & 1 deletion FWCore/ParameterSet/src/VParameterSetEntry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ namespace edm {
return theVPSet_->at(i);
}

std::vector<ParameterSet>::size_type VParameterSetEntry::size() const { return vpset().size(); }
std::vector<ParameterSet>::size_type VParameterSetEntry::size() const {
return theIDs_ ? theIDs_->size() : (theVPSet_ ? vpset().size() : 0);
}

void VParameterSetEntry::registerPsetsAndUpdateIDs() {
fillVPSet();
Expand Down

0 comments on commit bdfd19d

Please sign in to comment.