summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/heapfree.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-03-24 15:57:29 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-03-24 16:00:26 +0100
commit2a713e3b944625c45154f0ea7f5703e918de758b (patch)
treec572bfa9e000f7e1fd815d2ab698ac27abf70e7d /cpukit/score/src/heapfree.c
parentlibcsupport: Use POSIX keys for GXX key functions (diff)
downloadrtems-2a713e3b944625c45154f0ea7f5703e918de758b.tar.bz2
score: _Heap_Protection_set_delayed_free_fraction
Add and use _Heap_Protection_set_delayed_free_fraction(). This makes it possible to avoid a dependency on _Thread_Dispatch_is_enabled().
Diffstat (limited to 'cpukit/score/src/heapfree.c')
-rw-r--r--cpukit/score/src/heapfree.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/cpukit/score/src/heapfree.c b/cpukit/score/src/heapfree.c
index df51438f0c..e577e1313a 100644
--- a/cpukit/score/src/heapfree.c
+++ b/cpukit/score/src/heapfree.c
@@ -20,7 +20,6 @@
#endif
#include <rtems/score/heapimpl.h>
-#include <rtems/score/threadimpl.h>
#ifndef HEAP_PROTECTION
#define _Heap_Protection_determine_block_free( heap, block ) true
@@ -83,26 +82,13 @@
bool do_free = true;
Heap_Block *const next = block->Protection_begin.next_delayed_free_block;
- /*
- * Sometimes after a free the allocated area is still in use. An example
- * is the task stack of a thread that deletes itself. The thread dispatch
- * disable level is a way to detect this use case.
- */
- if ( _Thread_Dispatch_is_enabled() ) {
- if ( next == NULL ) {
- _Heap_Protection_delay_block_free( heap, block );
- do_free = false;
- } else if ( next == HEAP_PROTECTION_OBOLUS ) {
- _Heap_Protection_check_free_block( heap, block );
- } else {
- _Heap_Protection_block_error( heap, block );
- }
- } else if ( next == NULL ) {
- /*
- * This is a hack to prevent heavy workspace fragmentation which would
- * lead to test suite failures.
- */
- _Heap_Protection_free_all_delayed_blocks( heap );
+ if ( next == NULL ) {
+ _Heap_Protection_delay_block_free( heap, block );
+ do_free = false;
+ } else if ( next == HEAP_PROTECTION_OBOLUS ) {
+ _Heap_Protection_check_free_block( heap, block );
+ } else {
+ _Heap_Protection_block_error( heap, block );
}
return do_free;