changeset 5182:cddf28cfcd8d

style
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 25 Mar 2023 11:38:37 +0100
parents 65b05b44ae4c
children 5ec3dcdf78b9
files OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/ServerContext.h
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerContext.cpp	Sat Mar 25 11:27:37 2023 +0100
+++ b/OrthancServer/Sources/ServerContext.cpp	Sat Mar 25 11:38:37 2023 +0100
@@ -107,6 +107,8 @@
   {
   }
 
+
+#if HAVE_MALLOC_TRIM == 1
   void ServerContext::HousekeeperThread(ServerContext* that,
                                         unsigned int sleepDelay)
   {
@@ -117,11 +119,11 @@
       
       // If possible, gives memory back to the system 
       // (see OrthancServer/Resources/ImplementationNotes/memory_consumption.txt)
-#if HAVE_MALLOC_TRIM == 1
       malloc_trim(128*1024);
-#endif
     }
   }
+#endif
+
   
   void ServerContext::ChangeThread(ServerContext* that,
                                    unsigned int sleepDelay)
@@ -435,11 +437,13 @@
 
       listeners_.push_back(ServerListener(luaListener_, "Lua"));
       changeThread_ = boost::thread(ChangeThread, this, (unitTesting ? 20 : 100));
+      
 #if HAVE_MALLOC_TRIM == 1
-      housekeeperThread_ = boost::thread(HousekeeperThread, this, 1000);
+      housekeeperThread_ = boost::thread(HousekeeperThread, this, 100);
 #else
       LOG(INFO) << "Your platform does not support malloc_trim(), not starting the housekeeper thread";
 #endif
+      
       dynamic_cast<DcmtkTranscoder&>(*dcmtkTranscoder_).SetLossyQuality(lossyQuality);
     }
     catch (OrthancException&)
--- a/OrthancServer/Sources/ServerContext.h	Sat Mar 25 11:27:37 2023 +0100
+++ b/OrthancServer/Sources/ServerContext.h	Sat Mar 25 11:38:37 2023 +0100
@@ -187,8 +187,10 @@
     static void SaveJobsThread(ServerContext* that,
                                unsigned int sleepDelay);
 
+#if HAVE_MALLOC_TRIM == 1
     static void HousekeeperThread(ServerContext* that,
                                   unsigned int sleepDelay);
+#endif
 
     void SaveJobsEngine();