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:
commit
6dd69e7134
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user