From 12a5014193218b6fae85fa6755a03037da0f954a Mon Sep 17 00:00:00 2001 From: "W. Eric Norum" Date: Sun, 11 May 2008 20:18:01 +0000 Subject: [PATCH] Use more efficient mechanism for determining free space. --- src/RTEMS/base/rtems_init.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/RTEMS/base/rtems_init.c b/src/RTEMS/base/rtems_init.c index d51b31903..3daad57d2 100644 --- a/src/RTEMS/base/rtems_init.c +++ b/src/RTEMS/base/rtems_init.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -323,14 +323,15 @@ static void netStatCallFunc(const iocshArgBuf *args) static const iocshFuncDef heapSpaceFuncDef = {"heapSpace",0,NULL}; static void heapSpaceCallFunc(const iocshArgBuf *args) { - unsigned long n = malloc_free_space(); + rtems_malloc_statistics_t stats; - if (n >= 1024*1024) { - double x = (double)n / (1024 * 1024); + malloc_get_statistics(&stats); + if (stats.space_available >= 1024*1024) { + double x = (double)stats.space_available / (1024 * 1024); printf("Heap space: %.1f MB\n", x); } else { - double x = (double)n / 1024; + double x = (double)stats.space_available / 1024; printf("Heap space: %.1f kB\n", x); } }