IBucketElementFreeList

Type generic BucketElementFreeList base class.

Constructors

this
this(size_t bucket_element_sizeof)

Constructor.

Members

Classes

ParkingStack
class ParkingStack

Allows using the free list as a stack to park objects without marking them as free. The parked object are appended to the free list after the free objects currently in the list. At most one ParkingStack instance may exist at a time. While a ParkingStack instance exists, no public FreeList method may be used.

Functions

allocate
void* allocate()

Obtains an object either from the free list, if available, or from new_object if the free list is empty.

deallocate
void deallocate(void* old_object)

Appends old_object to the free list.

getNext
void* getNext(void* object)

Obtains the next object of object. object is never null but the next object may be.

length
size_t length()
newElement
void* newElement()

Allocates a new object. Called by get() if the list is empty.

parkElements
void parkElements(size_t n, void delegate(IParkingStack park) dg)

Calls dg with an IParkingStack instance that is set up to keep n elements.

setNext
void setNext(void* object, void* next)

Sets the next object of object. object is never null but next may be.

Inherited Members

From IAllocator

bucket_element_size
size_t bucket_element_size;

Stores the size of a single allocated element.

get
void* get()

Gets or allocates an object

allocate
void* allocate()

Performs the actual allocation of an object

recycle
void recycle(void* old)

Recycles or deletes an object that is no longer used.

deallocate
void deallocate(void* old)

Performs the actual recycling of an object. See recycle() documentation.

memoryUsed
size_t memoryUsed()

Return the amount of memory currently used.

IParkingStack
class IParkingStack

Helper class to temprarily park a certain number of objects.

parkElements
void parkElements(size_t n, void delegate(IParkingStack park) dg)

Calls dg with an IParkingStack instance that is set up to keep n elements.

Meta