mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
Slab allocator update
Unused slabs which get recycled are no longer reinitialized from scratch if their chunk size matches what the allocator needed. If the chunk size matches, the list of available chunks is left unchanged, and just the various counters are reset. Added __get_slab_stats() function. Added support for global __slab_purge_threshold tuning variable. Added a short test program for the slab allocator. The malloc-test program was linked against the wrong object file in GNUmakefile.68k. Fixed.
This commit is contained in:
@ -235,6 +235,11 @@ struct SlabNode
|
||||
/* How many chunks of this slab are currently in use? */
|
||||
ULONG sn_UseCount;
|
||||
|
||||
/* How many times was this slab reused instead of allocating
|
||||
* it from system memory?
|
||||
*/
|
||||
ULONG sn_NumReused;
|
||||
|
||||
/* This contains all the chunks of memory which are available
|
||||
* for allocation.
|
||||
*/
|
||||
@ -286,7 +291,7 @@ struct SlabData
|
||||
*/
|
||||
size_t sd_StandardSlabSize;
|
||||
|
||||
/* These fields kees track of how many entries there are in
|
||||
/* These fields keep track of how many entries there are in
|
||||
* the sd_SingleAllocations list, and how much memory these
|
||||
* allocations occupy.
|
||||
*/
|
||||
@ -303,6 +308,7 @@ struct SlabData
|
||||
|
||||
extern struct SlabData NOCOMMON __slab_data;
|
||||
extern unsigned long NOCOMMON __slab_max_size;
|
||||
extern unsigned long NOCOMMON __slab_purge_threshold;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user