#include <Malloc_T.h>
Inheritance diagram for ACE_Dynamic_Cached_Allocator< ACE_LOCK >:


Public Member Functions | |
| ACE_Dynamic_Cached_Allocator (size_t n_chunks, size_t chunk_size) | |
| ~ACE_Dynamic_Cached_Allocator (void) | |
| Clear things up. | |
| void * | malloc (size_t nbytes=0) |
| 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') |
| void | free (void *) |
| Return a chunk of memory back to free list cache. | |
| size_t | pool_depth (void) |
| Return the number of chunks available in the cache. | |
Private Attributes | |
| char * | pool_ |
| ACE_Locked_Free_List< ACE_Cached_Mem_Pool_Node< char >, ACE_LOCK > | free_list_ |
| size_t | chunk_size_ |
| Remember the size of our chunks. | |
This class enables caching of dynamically allocated, fixed-size chunks. Notice that the chunk_size must be greater than or equal to sizeof (void*) for this to work properly.
This class can be configured flexibly with different types of ACE_LOCK strategies that support the ACE_Thread_Mutex and ACE_Process_Mutex constructor API.
|
||||||||||||||||
|
Create a cached memory pool with n_chunks chunks each with chunk_size 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 less or equal to chunk_size, and is otherwise ignored since calloc() always returns a pointer to an item of chunk_size. 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 less or equal to chunk_size, and is otherwise ignored since malloc() always returns a pointer to an item of chunk_size size. Reimplemented from ACE_New_Allocator. |
|
||||||||||
|
Return the number of chunks available in the cache.
|
|
|||||
|
Remember the size of our chunks.
|
|
|||||
|
Maintain a cached memory free list. We use |
|
|||||
|
Remember how we allocate the memory in the first place so we can clear things up later. |
1.3.9.1