diff options
Diffstat (limited to 'cpukit/score/src/objectfree.c')
-rw-r--r-- | cpukit/score/src/objectfree.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/cpukit/score/src/objectfree.c b/cpukit/score/src/objectfree.c index 30ea1e36e5..3e7c8e409c 100644 --- a/cpukit/score/src/objectfree.c +++ b/cpukit/score/src/objectfree.c @@ -27,28 +27,32 @@ void _Objects_Free( Objects_Control *the_object ) { - uint32_t allocation_size = information->allocation_size; - _Assert( _Objects_Allocator_is_owner() ); _Chain_Append_unprotected( &information->Inactive, &the_object->Node ); if ( information->auto_extend ) { - uint32_t block; + Objects_Maximum objects_per_block; + Objects_Maximum block; + Objects_Maximum inactive; + + objects_per_block = information->objects_per_block; + block = _Objects_Get_index( the_object->id ); + block -= _Objects_Get_index( information->minimum_id ); + block /= objects_per_block; - block = (uint32_t) (_Objects_Get_index( the_object->id ) - - _Objects_Get_index( information->minimum_id )); - block /= information->allocation_size; + ++information->inactive_per_block[ block ]; - information->inactive_per_block[ block ]++; - information->inactive++; + inactive = information->inactive; + ++inactive; + information->inactive = inactive; /* * Check if the threshold level has been met of - * 1.5 x allocation_size are free. + * 1.5 x objects_per_block are free. */ - if ( information->inactive > ( allocation_size + ( allocation_size >> 1 ) ) ) { + if ( inactive > ( objects_per_block + ( objects_per_block >> 1 ) ) ) { _Objects_Shrink_information( information ); } } |