From a3f4198f546e6e41323a8d0871aad74fcbb9b252 Mon Sep 17 00:00:00 2001
From: Jonas Rembser <jonas.rembser@cern.ch>
Date: Tue, 20 Apr 2021 12:43:20 +0200
Subject: [PATCH] [RF] Deallocate memory owned by empty MemPoolForRooSets
 Arenas

If an arena in the MemPoolForRooSets is not referenced anymore, it
should delete the memory it has allocated.
---
 roofit/roofitcore/src/MemPoolForRooSets.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/roofit/roofitcore/src/MemPoolForRooSets.h b/roofit/roofitcore/src/MemPoolForRooSets.h
index 388a3e7f3f6..a9b5218d66c 100644
--- a/roofit/roofitcore/src/MemPoolForRooSets.h
+++ b/roofit/roofitcore/src/MemPoolForRooSets.h
@@ -126,6 +126,7 @@ class MemPoolForRooSets {
     {
       if (inPool(ptr)) {
         --refCount;
+        tryFree(false);
 #ifndef NDEBUG
         const std::size_t index = static_cast<RooSet_t *>(ptr) - memBegin;
         if (deletedElements.count(index) != 0) {
-- 
GitLab