Allocator for Class objects. More...
#include <Allocator.h>
Inherits Allocator.
Inherited by SparseClassAllocator< C >.
Public Member Functions | |
C * | alloc () |
Allocates objects of the templated type. | |
void | free (C *ptr) |
Deallocates objects of the templated type. | |
void * | alloc_void () |
Allocate objects of the templated type via the inherited interface using void pointers. | |
void | free_void (void *ptr) |
Deallocate objects of the templated type via the inherited interface using void pointers. | |
ClassAllocator (const char *name, unsigned int chunk_size=128, unsigned int alignment=16) | |
Create a new class specific ClassAllocator. | |
Data Fields | |
struct { | |
C typeObject | |
int64_t space_holder | |
} | proto |
Allocator for Class objects.
It uses a prototype object to do fast initialization. Prototype of the template class is created when the fast allocator is created. This is instantiated with default (no argument) constructor. Constructor is not called for the allocated objects. Instead, the prototype is just memory copied onto the new objects. This is done for performance reasons.
Definition at line 111 of file Allocator.h.
ClassAllocator< C >::ClassAllocator | ( | const char * | name, | |
unsigned int | chunk_size = 128 , |
|||
unsigned int | alignment = 16 | |||
) | [inline] |
Create a new class specific ClassAllocator.
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. |
Definition at line 163 of file Allocator.h.
References Allocator::fl, ink_freelist_init(), and RND16.
C* ClassAllocator< C >::alloc | ( | ) | [inline] |
Allocates objects of the templated type.
Reimplemented in SparseClassAllocator< C >.
Definition at line 115 of file Allocator.h.
References Allocator::fl, ink_freelist_new(), memcpy, and ClassAllocator< C >::proto.
Referenced by ClassAllocator< C >::alloc_void(), HttpUpdateSM::allocate(), CacheVC::do_read_call(), BlasterUrlList::invokeUrlBlaster(), new_CacheRemoveCont(), RemapProcessor::perform_remap(), thread_alloc(), thread_alloc_init(), TSFetchCreate(), TSFetchPages(), and TSFetchUrl().
void* ClassAllocator< C >::alloc_void | ( | ) | [inline] |
Allocate objects of the templated type via the inherited interface using void pointers.
Reimplemented from Allocator.
Definition at line 139 of file Allocator.h.
References ClassAllocator< C >::alloc().
void ClassAllocator< C >::free | ( | C * | ptr | ) | [inline] |
Deallocates objects of the templated type.
ptr | pointer to be freed. |
Definition at line 129 of file Allocator.h.
References Allocator::fl, and ink_freelist_free().
Referenced by SpdyClientSession::cleanup_request(), ProtectedQueue::dequeue_timed(), BlasterUrlList::free(), PrefetchUrlEntry::free(), UDPIOEvent::free(), free_CacheRemoveCont(), free_EvacuationBlock(), ClassAllocator< C >::free_void(), ICPRequestCont::operator delete(), CacheLookupHttpConfig::operator delete(), thread_free(), and thread_freeup().
void ClassAllocator< C >::free_void | ( | void * | ptr | ) | [inline] |
Deallocate objects of the templated type via the inherited interface using void pointers.
ptr | pointer to be freed. |
Reimplemented from Allocator.
Definition at line 151 of file Allocator.h.
References ClassAllocator< C >::free().
struct { ... } ClassAllocator< C >::proto |
Referenced by SparseClassAllocator< C >::alloc(), ClassAllocator< C >::alloc(), thread_alloc(), and thread_alloc_init().
int64_t ClassAllocator< C >::space_holder |
Definition at line 172 of file Allocator.h.
C ClassAllocator< C >::typeObject |
Definition at line 171 of file Allocator.h.
Referenced by thread_alloc(), and thread_alloc_init().