mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
Slab allocator changes
If the first slab in the list of slabs which share the same chunk size has no more room, it means that all other slabs following it have no room either. This speeds up the test to find a slab with free space, which can now abort and directly proceed to allocate memory for a new slab. If an empty slab's decay count hits zero, it is moved to the front of the empty slab list to be reclaimed more quickly. Allocations made from the slab now carry a pointer back to the slab which they are a part of. This speeds up deallocation but has the downside of making the smallest usable slab chunk size 64 bytes, which is double what used to be the minimum before.
This commit is contained in:
@ -47,7 +47,7 @@ __get_slab_usage(__slab_usage_callback callback)
|
||||
if(__slab_data.sd_InUse)
|
||||
{
|
||||
struct __slab_usage_information sui;
|
||||
struct SlabNode * sn;
|
||||
const struct SlabNode * sn;
|
||||
BOOL stop;
|
||||
int i;
|
||||
|
||||
@ -98,6 +98,10 @@ __get_slab_usage(__slab_usage_callback callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
(*callback)(&sui);
|
||||
}
|
||||
|
||||
__memory_unlock();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user