Allocator for space class, a class with a lot of uninitialized space/members. More...
#include <Allocator.h>
Inherits ClassAllocator< C >.
Public Member Functions | |
C * | alloc () |
Allocates objects of the templated type. | |
SparseClassAllocator (const char *name, unsigned int chunk_size=128, unsigned int alignment=16, void(*instantiate_func)(C *proto, C *instance)=NULL) | |
Create a new class specific SparseClassAllocator. |
Allocator for space class, a class with a lot of uninitialized space/members.
It uses an instantiate fucntion do initialization of objects. This is particulary useful if most of the space in the objects does not need to be intialized. The inifunction passed can be used to intialize a few fields selectively. Using ClassAllocator for space objects would unnecessarily initialized all of the members.
Definition at line 186 of file Allocator.h.
SparseClassAllocator< C >::SparseClassAllocator | ( | const char * | name, | |
unsigned int | chunk_size = 128 , |
|||
unsigned int | alignment = 16 , |
|||
void(*)(C *proto, C *instance) | instantiate_func = NULL | |||
) | [inline] |
Create a new class specific SparseClassAllocator.
name | some identifying name, used for mem tracking purposes. | |
chunk_size | number of units to be allocated if free pool is empty. | |
alignment | of objects must be a power of 2. | |
instantiate_func |
Definition at line 212 of file Allocator.h.
C* SparseClassAllocator< C >::alloc | ( | ) | [inline] |
Allocates objects of the templated type.
Reimplemented from ClassAllocator< C >.
Definition at line 191 of file Allocator.h.
References Allocator::fl, ink_freelist_new(), memcpy, and ClassAllocator< C >::proto.
Referenced by HttpSM::allocate().