Heap management

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
steved
Posts: 834
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 138 times

Heap management

Post 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?
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Heap management

Post 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
Post Reply