1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/newlib: update heap_stats for multiple heaps

This commit is contained in:
Gunar Schorcht 2020-02-29 12:23:57 +01:00
parent 23c5d34284
commit fd1052bc9a

View File

@ -209,7 +209,12 @@ void *_sbrk_r(struct _reent *r, ptrdiff_t incr)
__attribute__((weak)) void heap_stats(void)
{
struct mallinfo minfo = mallinfo();
long int heap_size = &_eheap - &_sheap;
long int heap_size = 0;
for (unsigned int i = 0; i < NUM_HEAPS; i++) {
heap_size += heaps[i].end - heaps[i].start;
}
printf("heap: %ld (used %d, free %ld) [bytes]\n",
heap_size, minfo.uordblks, heap_size - minfo.uordblks);
}