From: Pasukhin Dmitry Date: Sun, 23 Mar 2025 20:26:14 +0000 (+0000) Subject: Foundation Classes - Checking for MallInfo version #459 X-Git-Tag: V7_9_1~11 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=8bbfddfacf659376456ca79f7c170e47c3391a95;p=occt.git Foundation Classes - Checking for MallInfo version #459 Fix memory usage reporting for GLIBC compatibility in OSD_MemInfo --- diff --git a/src/OSD/OSD_MemInfo.cxx b/src/OSD/OSD_MemInfo.cxx index 90709397e5..079b7b7a8f 100644 --- a/src/OSD/OSD_MemInfo.cxx +++ b/src/OSD/OSD_MemInfo.cxx @@ -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)