Skip to content

Commit 8f8985b

Browse files
authored
Avoid MonitorObjectCollection to grow in size (#2169)
Currently the published objects are inserted in the `MonitorObjectCollection` via the `TObjArray::Add()` method, which always appends new elements at the end of the array. When un-publishing objects, they are removed via the `TObjArray::Remove()` method, which does not reduce the size of the TObjArray. Instead, the removed slots are set to `nullptr`. The proposed solution is to add a call to `TObjArray::Compress()` after `TObjArray::Remove()`, which forces the removal of empty slots from the array.
1 parent cd342d8 commit 8f8985b

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

Framework/src/ObjectsManager.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ void ObjectsManager::stopPublishing(const string& objectName)
131131
{
132132
auto* mo = dynamic_cast<MonitorObject*>(getMonitorObject(objectName));
133133
mMonitorObjects->Remove(mo);
134+
mMonitorObjects->Compress();
134135
}
135136

136137
void ObjectsManager::stopPublishingAll()

0 commit comments

Comments
 (0)