0032319: Foundation Classes, OSD_MemInfo - use mallinfo2() instead of deprecated...
authorkgv <kgv@opencascade.com>
Thu, 22 Apr 2021 17:42:47 +0000 (20:42 +0300)
committerbugmaster <bugmaster@opencascade.com>
Wed, 28 Apr 2021 15:18:26 +0000 (18:18 +0300)
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;
   }