diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2005-01-20 18:22:29 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2005-01-20 18:22:29 +0000 |
commit | 962e894f4ed0836a5aad472805682bb2f2c90201 (patch) | |
tree | 2bb745c9bed1353cb59f88e00da9962e649009bf /cpukit/score/src/heapgetfreeinfo.c | |
parent | 2005-01-20 Joel Sherrill <joel@OARcorp.com> (diff) | |
download | rtems-962e894f4ed0836a5aad472805682bb2f2c90201.tar.bz2 |
2005-01-20 Sergei Organov <osv@topconrd.ru>
PR 536/rtems
Heap manager re-implementation to consume less memory and still satisfy
alignment requirements.
* score/src/heap.c, score/src/heapallocate.c, score/src/heapextend.c,
score/src/heapfree.c, score/src/heapgetinfo.c,
score/src/heapgetfreeinfo.c, core/src/heapsizeofuserarea.c,
score/src/heapwalk.c, core/macros/rtems/score/heap.inl,
score/inline/rtems/score/heap.inl,
score/include/rtems/score/heap.h: Reimplemented.
* score/src/heapallocatealigned.c: new file
* score/Makefile.am: HEAP_C_FILES: add score/src/heapallocatealigned.c
Diffstat (limited to 'cpukit/score/src/heapgetfreeinfo.c')
-rw-r--r-- | cpukit/score/src/heapgetfreeinfo.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/cpukit/score/src/heapgetfreeinfo.c b/cpukit/score/src/heapgetfreeinfo.c index 910eda838f..1b8d8598a0 100644 --- a/cpukit/score/src/heapgetfreeinfo.c +++ b/cpukit/score/src/heapgetfreeinfo.c @@ -37,21 +37,24 @@ void _Heap_Get_free_information( ) { Heap_Block *the_block; + Heap_Block *const tail = _Heap_Tail(the_heap); info->number = 0; info->largest = 0; info->total = 0; - for ( the_block = the_heap->first; - ; - the_block = the_block->next ) { - if ( the_block == _Heap_Tail( the_heap ) ) - return; - - info->number++; - info->total += the_block->front_flag; + for(the_block = _Heap_First(the_heap); + the_block != tail; + the_block = the_block->next) + { + uint32_t const the_size = _Heap_Block_size(the_block); + + /* As we always coalesce free blocks, prev block must have been used. */ + _HAssert(_Heap_Is_prev_used(the_block)); - if ( the_block->front_flag >= info->largest ) - info->largest = the_block->front_flag; + info->number++; + info->total += the_size; + if ( info->largest < the_size ) + info->largest = the_size; } } |