0032319: Foundation Classes, OSD_MemInfo - use mallinfo2() instead of deprecated...
[occt.git] / src / OSD / OSD_MemInfo.cxx
index 08a939b..d9bb913 100644 (file)
@@ -182,7 +182,17 @@ void OSD_MemInfo::Update()
 #elif (defined(__linux__) || defined(__linux))
   if (IsActive (MemHeapUsage))
   {
+  #if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
+    #if __GLIBC_PREREQ(2,33)
+      #define HAS_MALLINFO2
+    #endif
+  #endif
+
+  #ifdef HAS_MALLINFO2
+    const struct mallinfo2 aMI = mallinfo2();
+  #else
     const struct mallinfo aMI = mallinfo();
+  #endif
     myCounters[MemHeapUsage] = aMI.uordblks;
   }