1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-27 15:31:17 +01:00

Merge pull request #13515 from gschorcht/sys/newlib_multiheap_stats

sys/newlib_syscalls_default: update heap_stats for multiple heaps
This commit is contained in:
benpicco 2020-02-29 13:59:03 +01:00 committed by GitHub
commit 6dd69e7134
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);
}