Skip to content

Commit 501c1c7

Browse files
committed
Prefer mallinfo2() over deprecated mallinfo() in AFunction.cpp
1 parent 8854305 commit 501c1c7

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

AutoGeneratedFile.tar.gz

2.96 KB
Binary file not shown.

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2058,7 +2058,7 @@ fi
20582058
AC_CHECK_HEADERS(malloc.h,ff_malloc_h=1)
20592059
AC_SUBST(FF_MALLOC_H,$ff_malloc_h)
20602060

2061-
AC_CHECK_FUNCS(asinh acosh atanh getenv jn erfc tgamma gettimeofday mallinfo mstats)
2061+
AC_CHECK_FUNCS(asinh acosh atanh getenv jn erfc tgamma gettimeofday mallinfo2 mallinfo mstats)
20622062
AC_CHECK_FUNCS(srandomdev)
20632063

20642064

src/fflib/AFunction.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ long storageused()
8484
struct mstats mem1;
8585
mem1 = mstats();
8686
return mem1.bytes_used;
87+
#elif HAVE_MALLINFO2
88+
struct mallinfo2 mem1;
89+
mem1=mallinfo2();
90+
return static_cast<long>(mem1.uordblks);
8791
#elif HAVE_MALLINFO
8892
struct mallinfo mem1;
8993
mem1=mallinfo();
@@ -99,6 +103,10 @@ long storagetotal()
99103
struct mstats mem1;
100104
mem1 = mstats();
101105
return mem1.bytes_total;
106+
#elif HAVE_MALLINFO2
107+
struct mallinfo2 mem1;
108+
mem1=mallinfo2();
109+
return static_cast<long>(mem1.keepcost);
102110
#elif HAVE_MALLINFO
103111
struct mallinfo mem1;
104112
mem1=mallinfo();

0 commit comments

Comments
 (0)