Cached free list. More...
|Undelying free-list type. |
|Free-list node. |
|Creates empty free list. |
|Destroys the free list. Free-list must be empty. More...|
|void||put (node *pNode)|
|node *||get ()|
|Gets a node from the free list. If the list is empty, returns |
|bool||empty () const|
|Checks whether the free list is empty. |
|template<typename Disposer >|
|void||clear (Disposer disp)|
|Clears the free list (not atomic) More...|
|static size_t const||c_cache_size = CacheSize|
|Cache size. |
|static unsigned const||c_padding = Padding|
|Cache element padding. |
Cached free list.
The class that is a wrapper over other
FreeList contains a small cache of free elements. Before placing a new item into underlying
FreeList the cached free-list tryes to put that item into the cache if its corresponding slot is empty. The slot is calculated by current thread id:
When getting the free-list checks the corresponding cache slot. If it is not empty, its contents is returned.
In some cases such simple algorithm significantly reduces
Destroys the free list. Free-list must be empty.
clear()with an appropriate disposer.
Clears the free list (not atomic)
For each element
disp disposer is called to free memory. The
This method must be explicitly called before the free list destructor.