#include <Malloc_T.h>
Inheritance diagram for ACE_Cached_Allocator
Public Methods | |
ACE_Cached_Allocator (size_t n_chunks) | |
Create a cached memory poll with <n_chunks> chunks each with sizeof (TYPE) size. | |
~ACE_Cached_Allocator (void) | |
clear things up. | |
void* | malloc (size_t nbytes = sizeof (T)) |
virtual void* | calloc (size_t nbytes, char initial_value = '\0') |
virtual void* | calloc (size_t n_elem, size_t elem_size, char initial_value = '\0') |
This method is a no-op and just returns 0 since the free list only works with fixed sized entities. | |
void | free (void *) |
Return a chunk of memory back to free list cache. | |
Private Attributes | |
char* | pool_ |
Remember how we allocate the memory in the first place so we can clear things up later. | |
ACE_Locked_Free_List<ACE_Cached_Mem_Pool_Node< T>, ACE_LOCK> | free_list_ |
Maintain a cached memory free list. |
This class enables caching of dynamically allocated, fixed-sized classes. Notice that the sizeof (TYPE)
must be greater than or equal to sizeof (void*)
for this to work properly.
|
Create a cached memory poll with <n_chunks> chunks each with sizeof (TYPE) size.
|
|
clear things up.
|
|
This method is a no-op and just returns 0 since the free list only works with fixed sized entities.
Reimplemented from ACE_New_Allocator. |
|
Get a chunk of memory from free list cache, giving them <initial_value>. Note that <nbytes> is only checked to make sure that it's <= to sizeof T, and is otherwise ignored since <malloc> always returns a pointer to an item of sizeof (T). Reimplemented from ACE_New_Allocator. |
|
Return a chunk of memory back to free list cache.
Reimplemented from ACE_New_Allocator. |
|
Get a chunk of memory from free list cache. Note that <nbytes> is only checked to make sure that it's <= to sizeof T, and is otherwise ignored since <malloc> always returns a pointer to an item of sizeof (T). Reimplemented from ACE_New_Allocator. |
|
Maintain a cached memory free list.
|
|
Remember how we allocate the memory in the first place so we can clear things up later.
|