forked from Imagelibrary/rtems
@@ -407,15 +407,7 @@ Heap_Block *_Heap_Block_allocate(
|
|||||||
(*heap->Protection.block_error)( heap, block, reason );
|
(*heap->Protection.block_error)( heap, block, reason );
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _Heap_Protection_free_all_delayed_blocks( Heap_Control *heap )
|
void _Heap_Protection_free_all_delayed_blocks( Heap_Control *heap );
|
||||||
{
|
|
||||||
uintptr_t large = 0
|
|
||||||
- (uintptr_t) HEAP_BLOCK_HEADER_SIZE
|
|
||||||
- (uintptr_t) HEAP_ALLOC_BONUS
|
|
||||||
- (uintptr_t) 1;
|
|
||||||
void *p = _Heap_Allocate( heap, large );
|
|
||||||
_Heap_Free( heap, p );
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -73,6 +73,15 @@
|
|||||||
|
|
||||||
return search_again;
|
return search_again;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _Heap_Protection_free_all_delayed_blocks( Heap_Control *heap )
|
||||||
|
{
|
||||||
|
bool search_again;
|
||||||
|
|
||||||
|
do {
|
||||||
|
search_again = _Heap_Protection_free_delayed_blocks( heap, 0 );
|
||||||
|
} while ( search_again );
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RTEMS_HEAP_DEBUG
|
#ifdef RTEMS_HEAP_DEBUG
|
||||||
|
|||||||
@@ -122,9 +122,13 @@ static void test_heap_default_init(void)
|
|||||||
|
|
||||||
static void test_free( void *addr )
|
static void test_free( void *addr )
|
||||||
{
|
{
|
||||||
|
uint32_t failed_allocs;
|
||||||
|
|
||||||
rtems_test_assert( _Heap_Free( &TestHeap, addr ) );
|
rtems_test_assert( _Heap_Free( &TestHeap, addr ) );
|
||||||
|
|
||||||
|
failed_allocs = TestHeap.stats.failed_allocs;
|
||||||
_Heap_Protection_free_all_delayed_blocks( &TestHeap );
|
_Heap_Protection_free_all_delayed_blocks( &TestHeap );
|
||||||
|
rtems_test_assert( failed_allocs == TestHeap.stats.failed_allocs );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_heap_cases_1(void)
|
static void test_heap_cases_1(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user