|
@@ -25,27 +25,27 @@ struct OldMemoryPoolBase {
|
|
|
protected:
|
|
|
OldMemoryPoolBase(const char *name, uint max_blocks, uint block_size_bits, uint item_size,
|
|
|
OldMemoryPoolNewBlock *new_block_proc, OldMemoryPoolCleanBlock *clean_block_proc) :
|
|
|
name(name), max_blocks(max_blocks), block_size_bits(block_size_bits),
|
|
|
new_block_proc(new_block_proc), clean_block_proc(clean_block_proc), current_blocks(0),
|
|
|
total_items(0), cleaning_pool(false), item_size(item_size), first_free_index(0), blocks(NULL) {}
|
|
|
|
|
|
const char *name; ///< Name of the pool (just for debugging)
|
|
|
|
|
|
const uint max_blocks; ///< The max amount of blocks this pool can have
|
|
|
const uint block_size_bits; ///< The size of each block in bits
|
|
|
|
|
|
/// Pointer to a function that is called after a new block is added
|
|
|
/** Pointer to a function that is called after a new block is added */
|
|
|
OldMemoryPoolNewBlock *new_block_proc;
|
|
|
/// Pointer to a function that is called to clean a block
|
|
|
/** Pointer to a function that is called to clean a block */
|
|
|
OldMemoryPoolCleanBlock *clean_block_proc;
|
|
|
|
|
|
uint current_blocks; ///< How many blocks we have in our pool
|
|
|
uint total_items; ///< How many items we now have in this pool
|
|
|
|
|
|
bool cleaning_pool; ///< Are we currently cleaning the pool?
|
|
|
public:
|
|
|
const uint item_size; ///< How many bytes one block is
|
|
|
uint first_free_index; ///< The index of the first free pool item in this pool
|
|
|
byte **blocks; ///< An array of blocks (one block hold all the items)
|
|
|
|
|
|
/**
|