]> OCCT Git - occt.git/commitdiff
Foundation Classes - Checking for MallInfo version #459
authorPasukhin Dmitry <dpasukhi@opencascade.com>
Sun, 23 Mar 2025 20:26:14 +0000 (20:26 +0000)
committerGitHub <noreply@github.com>
Sun, 23 Mar 2025 20:26:14 +0000 (20:26 +0000)
Fix memory usage reporting for GLIBC compatibility in OSD_MemInfo

src/FoundationClasses/TKernel/OSD/OSD_MemInfo.cxx

index 90709397e5f4f616f9832109101231d9d91d4c21..079b7b7a8ff93614b042bdd2f22807d4efb4c597 100644 (file)
@@ -165,18 +165,23 @@ void OSD_MemInfo::Update()
   #elif (defined(__linux__) || defined(__linux))
   if (IsActive(MemHeapUsage))
   {
-    #if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
-      #if __GLIBC_PREREQ(2, 33)
+    #if defined(__GLIBC__)
+      #define HAS_MALLINFO
+      #if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 33)
         #define HAS_MALLINFO2
       #endif
     #endif
 
-    #ifdef HAS_MALLINFO2
+    #ifdef HAS_MALLINFO
+      #ifdef HAS_MALLINFO2
     const struct mallinfo2 aMI = mallinfo2();
-    #else
+      #else
     const struct mallinfo aMI = mallinfo();
-    #endif
+      #endif
     myCounters[MemHeapUsage] = aMI.uordblks;
+    #else
+    myCounters[MemHeapUsage] = 0;
+    #endif
   }
 
   if (!IsActive(MemVirtual) && !IsActive(MemWorkingSet) && !IsActive(MemWorkingSetPeak)