Public Member Functions | Protected Attributes

Allocator Class Reference

Allocator for fixed size memory blocks. More...

#include <Allocator.h>

Inherited by ClassAllocator< C >.

Collaboration diagram for Allocator:
Collaboration graph
[legend]

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

InkFreeListfl

Detailed Description

Allocator for fixed size memory blocks.

Definition at line 51 of file Allocator.h.


Constructor & Destructor Documentation

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.

Parameters:
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().


Member Function Documentation

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().


Field Documentation

InkFreeList* Allocator::fl [protected]

The documentation for this class was generated from the following file: