mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-01-24 18:11:44 +01:00
29 lines
890 B
Diff
29 lines
890 B
Diff
mallinfo() is not provided in musl. This patch uses getrusage() instead to use
|
|
the maximum resident set size as a (poor) approximation of the heap usage.
|
|
--- occt-V7_3_0p3.bin/src/OSD/OSD_MemInfo.cxx
|
|
+++ occt-V7_3_0p3/src/OSD/OSD_MemInfo.cxx
|
|
@@ -35,6 +35,9 @@
|
|
#include <sstream>
|
|
#include <fstream>
|
|
|
|
+#include <sys/time.h>
|
|
+#include <sys/resource.h>
|
|
+
|
|
#include <OSD_MemInfo.hxx>
|
|
|
|
// =======================================================================
|
|
@@ -147,8 +150,11 @@
|
|
}
|
|
aFile.close();
|
|
|
|
- struct mallinfo aMI = mallinfo();
|
|
- myCounters[MemHeapUsage] = aMI.uordblks;
|
|
+ // mallinfo() not available with musl. We use getrusage to approximate it
|
|
+ // with the maximum resident set size
|
|
+ struct rusage ru = { .ru_maxrss = 0 };
|
|
+ getrusage(RUSAGE_SELF, &ru);
|
|
+ myCounters[MemHeapUsage] = ru.ru_maxrss;
|
|
|
|
#elif (defined(__APPLE__))
|
|
struct task_basic_info aTaskInfo;
|