changeset 5181:65b05b44ae4c

properly finalizing the housekeeper thread that periodically calls malloc_trim()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 25 Mar 2023 11:27:37 +0100
parents d2626a062809
children cddf28cfcd8d
files OrthancServer/Sources/ServerContext.cpp
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerContext.cpp	Sat Mar 25 11:21:09 2023 +0100
+++ b/OrthancServer/Sources/ServerContext.cpp	Sat Mar 25 11:27:37 2023 +0100
@@ -436,7 +436,7 @@
       listeners_.push_back(ServerListener(luaListener_, "Lua"));
       changeThread_ = boost::thread(ChangeThread, this, (unitTesting ? 20 : 100));
 #if HAVE_MALLOC_TRIM == 1
-      housekeeperThread_ = boost::thread(HousekeeperThread, this, 100);
+      housekeeperThread_ = boost::thread(HousekeeperThread, this, 1000);
 #else
       LOG(INFO) << "Your platform does not support malloc_trim(), not starting the housekeeper thread";
 #endif
@@ -482,6 +482,11 @@
         saveJobsThread_.join();
       }
 
+      if (housekeeperThread_.joinable())
+      {
+        housekeeperThread_.join();
+      }
+
       jobsEngine_.GetRegistry().ResetObserver();
 
       if (isJobsEngineUnserialized_)