| Iris Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
IrisFreeList;
IrisFreeList* iris_free_list_new (void);
void iris_free_list_free (IrisFreeList *free_list);
IrisLink* iris_free_list_get (IrisFreeList *free_list);
void iris_free_list_put (IrisFreeList *free_list,
IrisLink *link);
IMPORTANT NOTE
The IrisFreeList is only for use by pointers that have the bottom two bits free. This means that for 32bit architectures the pointer must be aligned to sizeof(void*). GSlice allocations provide this.
END IMPORTANT NOTE
IrisFreeList is a basic free-list used by algorithms wishing to control their own basic memory management. This can be very useful in a couple situations. It helps get around the problem of not having Garbage Collection to implement certain lock-free algorithms. However, in the process, it helps deal with allocator contention at the same time, but only after decent use.
Technically, using a free-list is like leaking memory. So occasionally it will be a good idea to clean up the memory if it is relatively precious to your user. However, this feature is not yet supported.
IrisFreeList* iris_free_list_new (void);
Creates a new instance of IrisFreeList.
Returns : |
The newly created IrisFreeList |
void iris_free_list_free (IrisFreeList *free_list);
Frees the data associated with free_list. Unlike the other methods
of this data structure, this method is not always going to be thread
safe. Obviously you don't want to be accessing it while free'ing the
structure.
|
An IrisFreeList |
IrisLink* iris_free_list_get (IrisFreeList *free_list);
Retreives or creates a new IrisLink instance. The created link should
be returned to the free list using iris_free_list_put().
|
An IrisFreeList |
Returns : |
the previously allocated, or new IrisLink instance. |
void iris_free_list_put (IrisFreeList *free_list, IrisLink *link);
Puts back an IrisLink instance back to the IrisFreeList instance.
|
An IrisFreeList |
|
An IrisLink |