1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-01 17:36:21 +03:00

Foundation Classes - Checking for MallInfo version #459

Fix memory usage reporting for GLIBC compatibility in OSD_MemInfo
This commit is contained in:
Pasukhin Dmitry 2025-03-23 20:26:14 +00:00 committed by GitHub
parent 893747b46e
commit 986af180e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View 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)