Page 1 of 1

Heap management

Posted: Fri Mar 16, 2018 4:32 pm
by steved
I'm trying to decide whether I have a memory leak, and would like to be sure I correctly understand the way the default Chibi heap works. As far as I can tell:
1. The value reported by chCoreGetStatus() is 'unassigned' memory which has never been used. It will therefore remain static, or decrease, over time - never increase.
2. The values reported by chHeapStatus() reflect the status of memory which has actually been assigned to the heap; the value 'total' reflecting free space.

Is this correct?


As a matter of interest, has anyone instrumented malloc() and free() to look at this kind of situation?

Re: Heap management

Posted: Fri Mar 16, 2018 4:44 pm
by Giovanni
Hi,

1) Correct, it is contiguous unallocated space.
2) Correct again, the heap starts empty and allocates from "core" when needed, it never returns blocks to "core".

Giovanni