8 #ifndef OPENDDS_DCPS_CACHED_ALLOCATOR_WITH_OVERFLOW_T_H 9 #define OPENDDS_DCPS_CACHED_ALLOCATOR_WITH_OVERFLOW_T_H 22 #if !defined (ACE_LACKS_PRAGMA_ONCE) 45 template <
class T,
class ACE_LOCK>
65 size_t chunk_size =
sizeof(T);
74 for (
size_t c = 0; c <
n_chunks; c++) {
75 void* placement =
begin_ + c * chunk_size;
91 void*
malloc(
size_t nbytes =
sizeof(T))
94 if (nbytes >
sizeof(T))
106 " %Lu available from pool\n",
this, this->
available()));
135 unsigned char* tmp =
static_cast<unsigned char*
>(ptr);
137 if (tmp < begin_ || tmp >=
end_) {
139 }
else if (ptr != 0) {
144 " %Lu available from pool\n",
this, this->
available()));
void * malloc(size_t nbytes=sizeof(T))
ACE_Locked_Free_List< ACE_Cached_Mem_Pool_Node< T >, ACE_LOCK > free_list_
Maintain a cached memory free list.
virtual ACE_Cached_Mem_Pool_Node< T > * remove(void)
#define ACE_MALLOC_ROUNDUP(X, Y)
virtual void free(void *ptr)=0
~Cached_Allocator_With_Overflow()
Clear things up.
Cached_Allocator_With_Overflow(size_t n_chunks)
A fixed-size allocator that caches items for quicker access but if the pool is exhausted it will use ...
void free(void *ptr)
Return a chunk of memory back to free list cache.
static ACE_Allocator * instance(void)
virtual size_t size(void)
virtual void add(ACE_Cached_Mem_Pool_Node< T > *element)
Cached_Allocator_With_Overflow< ACE_Message_Block, ACE_Thread_Mutex > MessageBlockAllocator
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
virtual void * calloc(size_t, char='\0')
virtual void * calloc(size_t, size_t, char='\0')
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
The Internal API and Implementation of OpenDDS.
#define ACE_NOTSUP_RETURN(FAILVALUE)
#define ACE_PURE_FREE_LIST
Cached_Allocator_With_Overflow< ACE_Data_Block, ACE_Thread_Mutex > DataBlockAllocator
unsigned char * end_
The end of the pool.
virtual void * malloc(size_type nbytes)=0