--- a/ObjectMemory.st Tue Mar 15 22:59:29 2016 +0100
+++ b/ObjectMemory.st Thu Mar 17 22:17:07 2016 +0100
@@ -4875,15 +4875,13 @@
"return the number of bytes allocated (and used) by malloc."
%{ /* NOCONTEXT */
- extern int __stx_malloc_stats();
- long statsArray[3];
- int filled;
-
- filled = __stx_malloc_stats(statsArray, sizeof(statsArray));
- if (filled < 1) {
- RETURN(__mkSmallInteger(0));
- }
- RETURN ( __MKUINT(statsArray[0]));
+#ifdef __linux__
+# include <malloc.h>
+ struct mallinfo minfo;
+
+ minfo = mallinfo();
+ RETURN ( __MKUINT(minfo.uordblks));
+#endif
%}.
^ 0
@@ -4926,15 +4924,13 @@
"return the number of bytes reserved by malloc (may not have been used yet)."
%{ /* NOCONTEXT */
- extern int __stx_malloc_stats();
- long statsArray[3];
- int filled;
-
- filled = __stx_malloc_stats(statsArray, sizeof(statsArray));
- if (filled < 2) {
- RETURN(__mkSmallInteger(0));
- }
- RETURN ( __MKUINT(statsArray[1]));
+#ifdef __linux__
+#include <malloc.h>
+ struct mallinfo minfo;
+
+ minfo = mallinfo();
+ RETURN ( __MKUINT(minfo.usmblks));
+#endif
%}.
^ 0