Open yurivict opened 9 months ago
No, mallocinfo()
only exists in SunOS. FreeBSD doesn't have it.
As an alternative, you can use Google's tcmalloc from the google-perftools package. google-perftools has better performance than most other malloc libraries, and it provides all sorts of information about memory allocator.
Is this malloc documentation available on your FreeBSD? It should also be possible (albeit a pain) to extract memory information from the malloc_stats_print
function described there.
I created #411. Can you see if it fixes the first warning?
I don't have a BSD system of my own and won't be able to spin up a VM for a few weeks. Since PCU_GetMem
and pumi_getMem
are only used in debug messages in a few places, it's probably ok to do something like this for now (until a more robust fix for FreeBSD is added):
diff --git a/pcu/pcu_mem.c b/pcu/pcu_mem.c
index 8ac2345c..5532ffac 100644
--- a/pcu/pcu_mem.c
+++ b/pcu/pcu_mem.c
@@ -8,6 +8,7 @@
*******************************************************************************/
#include <PCU.h>
+#include "reel.h" // reel_fail
#if defined(__APPLE__)
@@ -54,5 +55,7 @@ double PCU_GetMem() {
#elif defined(__GNUC__)
struct mallinfo meminfo_now = mallinfo();
return ((double)meminfo_now.arena)/M;
+#else
+ reel_fail("mallinfo not supported.");
#endif
}
Or, if you want those tests to run more or less successfully:
diff --git a/pcu/pcu_mem.c b/pcu/pcu_mem.c
index 8ac2345c..889650fb 100644
--- a/pcu/pcu_mem.c
+++ b/pcu/pcu_mem.c
@@ -54,5 +54,7 @@ double PCU_GetMem() {
#elif defined(__GNUC__)
struct mallinfo meminfo_now = mallinfo();
return ((double)meminfo_now.arena)/M;
+#else
+ return 0.0;
#endif
}
In any case, I'm sure there are other systems where mallinfo isn't available, so there ought to be a solution.
Errors/warnings:
mallinfo is a linux-specific function.
Version: 2.2.8 clang-16 FreeBSD 14.0 STABLE