Coder Social home page Coder Social logo

Comments (4)

yurivict avatar yurivict commented on September 17, 2024 1

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.

from core.

bobpaw avatar bobpaw commented on September 17, 2024 1

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?

from core.

bobpaw avatar bobpaw commented on September 17, 2024

BSD might require -lmalloc according to the manpage.

from core.

bobpaw avatar bobpaw commented on September 17, 2024

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.

from core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.