diff options
Diffstat (limited to 'cpukit/score/include/rtems/score')
-rw-r--r-- | cpukit/score/include/rtems/score/heap.h | 1 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/heapimpl.h | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/heap.h b/cpukit/score/include/rtems/score/heap.h index 62a64e5715..1ca840d4a0 100644 --- a/cpukit/score/include/rtems/score/heap.h +++ b/cpukit/score/include/rtems/score/heap.h @@ -161,6 +161,7 @@ typedef struct Heap_Block Heap_Block; Heap_Block *first_delayed_free_block; Heap_Block *last_delayed_free_block; uintptr_t delayed_free_block_count; + uintptr_t delayed_free_fraction; } Heap_Protection; typedef struct { diff --git a/cpukit/score/include/rtems/score/heapimpl.h b/cpukit/score/include/rtems/score/heapimpl.h index abc573de19..a8948edd6f 100644 --- a/cpukit/score/include/rtems/score/heapimpl.h +++ b/cpukit/score/include/rtems/score/heapimpl.h @@ -347,6 +347,29 @@ Heap_Block *_Heap_Block_allocate( } #endif +/** + * @brief Sets the fraction of delayed free blocks that is actually freed + * during memory shortage. + * + * The default is to free half the delayed free blocks. This is equal to a + * fraction value of two. + * + * @param[in] heap The heap control. + * @param[in] fraction The fraction is one divided by this fraction value. + */ +RTEMS_INLINE_ROUTINE void _Heap_Protection_set_delayed_free_fraction( + Heap_Control *heap, + uintptr_t fraction +) +{ +#ifdef HEAP_PROTECTION + heap->Protection.delayed_free_fraction = fraction; +#else + (void) heap; + (void) fraction; +#endif +} + RTEMS_INLINE_ROUTINE Heap_Block *_Heap_Free_list_head( Heap_Control *heap ) { return &heap->free_list; |