Allocator for fixed size memory blocks. More...
#include <Allocator.h>
Inherited by ClassAllocator< C >.
Public Member Functions | |
void * | alloc_void () |
Allocate a block of memory (size specified during construction of Allocator. | |
void | free_void (void *ptr) |
Deallocate a block of memory allocated by the Allocator. | |
Allocator () | |
Allocator (const char *name, unsigned int element_size, unsigned int chunk_size=128, unsigned int alignment=8) | |
Creates a new allocator. | |
void | re_init (const char *name, unsigned int element_size, unsigned int chunk_size, unsigned int alignment) |
Re-initialize the parameters of the allocator. | |
Protected Attributes | |
InkFreeList * | fl |
Allocator for fixed size memory blocks.
Definition at line 51 of file Allocator.h.
Allocator::Allocator | ( | ) | [inline] |
Definition at line 71 of file Allocator.h.
References fl.
Allocator::Allocator | ( | const char * | name, | |
unsigned int | element_size, | |||
unsigned int | chunk_size = 128 , |
|||
unsigned int | alignment = 8 | |||
) | [inline] |
Creates a new allocator.
name | identification tag used for mem tracking . | |
element_size | size of memory blocks to be allocated. | |
chunk_size | number of units to be allocated if free pool is empty. | |
alignment | of objects must be a power of 2. |
Definition at line 84 of file Allocator.h.
References fl, and ink_freelist_init().
void* Allocator::alloc_void | ( | ) | [inline] |
Allocate a block of memory (size specified during construction of Allocator.
Reimplemented in ClassAllocator< C >.
Definition at line 59 of file Allocator.h.
References fl, and ink_freelist_new().
Referenced by blk_alloc(), HttpTransact::handle_trace_and_options_requests(), IOBufferBlock::realloc(), and thread_alloc().
void Allocator::free_void | ( | void * | ptr | ) | [inline] |
Deallocate a block of memory allocated by the Allocator.
Reimplemented in ClassAllocator< C >.
Definition at line 66 of file Allocator.h.
References fl, and ink_freelist_free().
Referenced by blk_free(), IOBufferData::dealloc(), HttpTransact::State::free_internal_msg_buffer(), thread_free(), and thread_freeup().
void Allocator::re_init | ( | const char * | name, | |
unsigned int | element_size, | |||
unsigned int | chunk_size, | |||
unsigned int | alignment | |||
) | [inline] |
Re-initialize the parameters of the allocator.
Definition at line 92 of file Allocator.h.
References fl, and ink_freelist_init().
Referenced by init_buffer_allocators().
InkFreeList* Allocator::fl [protected] |
Definition at line 99 of file Allocator.h.
Referenced by SparseClassAllocator< C >::alloc(), ClassAllocator< C >::alloc(), alloc_void(), Allocator(), ClassAllocator< C >::ClassAllocator(), ClassAllocator< C >::free(), free_void(), and re_init().