#include <Malloc_T.h>
Inheritance diagram for ACE_Malloc_T:
Public Types | |
typedef ACE_MEM_POOL | MEMORY_POOL |
typedef ACE_MEM_POOL_OPTIONS | MEMORY_POOL_OPTIONS |
typedef ACE_TYPENAME ACE_CB::ACE_Name_Node | NAME_NODE |
typedef ACE_TYPENAME ACE_CB::ACE_Malloc_Header | MALLOC_HEADER |
Public Methods | |
ACE_Malloc_T (const ACE_TCHAR *pool_name=0) | |
Initialize ACE_Malloc. More... | |
ACE_Malloc_T (const ACE_TCHAR *pool_name, const ACE_TCHAR *lock_name, const ACE_MEM_POOL_OPTIONS *options=0) | |
Initialize ACE_Malloc. More... | |
ACE_Malloc_T (const ACE_TCHAR *pool_name, const ACE_TCHAR *lock_name, const void *options=0) | |
This is necessary to work around template bugs with certain C++ compilers. More... | |
~ACE_Malloc_T (void) | |
Destructor. More... | |
int | ref_counter (void) |
Get Reference counter. More... | |
int | release (void) |
Release ref counter. More... | |
int | remove (void) |
Releases resources allocated by <ACE_Malloc>. More... | |
void * | malloc (size_t nbytes) |
Allocate <nbytes>, but don't give them any initial value. More... | |
void * | calloc (size_t nbytes, char initial_value='\0') |
Allocate <nbytes>, giving them <initial_value>. More... | |
void * | calloc (size_t n_elem, size_t elem_size, char initial_value='\0') |
Allocate <n_elem> each of size <elem_size>, giving them <initial_value>. More... | |
void | free (void *ptr) |
Deallocate memory pointed to by <ptr>, which must have been allocated previously by <this->malloc>. More... | |
MEMORY_POOL & | memory_pool (void) |
Returns a reference to the underlying memory pool. More... | |
int | bind (const char *name, void *pointer, int duplicates=0) |
Associate <name> with <pointer>. More... | |
int | trybind (const char *name, void *&pointer) |
Associate <name> with <pointer>. More... | |
int | find (const char *name, void *&pointer) |
Locate <name> and pass out parameter via <pointer>. If found, return 0, returns -1 if failure occurs. More... | |
int | find (const char *name) |
Returns 0 if <name> is in the mapping. -1, otherwise. More... | |
int | unbind (const char *name) |
Unbind (remove) the name from the map. More... | |
int | unbind (const char *name, void *&pointer) |
Unbind (remove) one association of <name> to <pointer>. More... | |
int | sync (ssize_t len=-1, int flags=MS_SYNC) |
Sync <len> bytes of the memory region to the backing store starting at <this->base_addr_>. More... | |
int | sync (void *addr, size_t len, int flags=MS_SYNC) |
Sync <len> bytes of the memory region to the backing store starting at <addr_>. More... | |
int | protect (ssize_t len=-1, int prot=PROT_RDWR) |
Change the protection of the pages of the mapped region to <prot> starting at <this->base_addr_> up to <len> bytes. More... | |
int | protect (void *addr, size_t len, int prot=PROT_RDWR) |
Change the protection of the pages of the mapped region to <prot> starting at <addr> up to <len> bytes. More... | |
ssize_t | avail_chunks (size_t size) const |
Returns a count of the number of available chunks that can hold <size> byte allocations. More... | |
ACE_LOCK & | mutex (void) |
Returns a pointer to the lock used to provide mutual exclusion to an <ACE_Malloc> allocator. More... | |
void | dump (void) const |
Dump the state of an object. More... | |
void * | base_addr (void) |
Return cb_ptr value. More... | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. More... | |
Private Methods | |
int | open (void) |
Initialize the Malloc pool. More... | |
int | shared_bind (const char *name, void *pointer) |
Associate <name> with <pointer>. Assumes that locks are held by callers. More... | |
void * | shared_find (const char *name) |
Try to locate <name>. More... | |
void * | shared_malloc (size_t nbytes) |
Allocate memory. Assumes that locks are held by callers. More... | |
void | shared_free (void *ptr) |
Deallocate memory. Assumes that locks are held by callers. More... | |
Private Attributes | |
ACE_CB * | cb_ptr_ |
Pointer to the control block that is stored in memory controlled by <MEMORY_POOL>. More... | |
MEMORY_POOL | memory_pool_ |
Pool of memory used by <ACE_Malloc> to manage its freestore. More... | |
ACE_LOCK | lock_ |
Lock that ensures mutual exclusion for the <MEMORY_POOL>. More... | |
Friends | |
class | ACE_Malloc_LIFO_Iterator_T< ACE_MEM_POOL_2, ACE_LOCK, ACE_CB > |
class | ACE_Malloc_FIFO_Iterator_T< ACE_MEM_POOL_2, ACE_LOCK, ACE_CB > |
This class can be configured flexibly with different MEMORY_POOL strategies and different types of ACE_LOCK strategies.
|
|
|
|
|
|
|
|
|
Initialize ACE_Malloc. This constructor passes <pool_name> to initialize the memory pool, and uses <ACE::basename> to automatically extract out the name used for the underlying lock name (if necessary). |
|
Initialize ACE_Malloc. This constructor passes <pool_name> to initialize the memory pool, and uses <lock_name> to automatically extract out the name used for the underlying lock name (if necessary). In addition, <options> is passed through to initialize the underlying memory pool. |
|
This is necessary to work around template bugs with certain C++ compilers.
|
|
Destructor.
|
|
Returns a count of the number of available chunks that can hold <size> byte allocations. Function can be used to determine if you have reached a water mark. This implies a fixed amount of allocated memory.
|
|
Return cb_ptr value.
|
|
Associate <name> with <pointer>. If <duplicates> == 0 then do not allow duplicate <name>/<pointer> associations, else if <duplicates> != 0 then allow duplicate <name>/<pointer> assocations. Returns 0 if successfully binds (1) a previously unbound <name> or (2) <duplicates> != 0, returns 1 if trying to bind a previously bound <name> and <duplicates> == 0, else returns -1 if a resource failure occurs. |
|
Allocate <n_elem> each of size <elem_size>, giving them <initial_value>.
|
|
Allocate <nbytes>, giving them <initial_value>.
|
|
Dump the state of an object.
|
|
Returns 0 if <name> is in the mapping. -1, otherwise.
|
|
Locate <name> and pass out parameter via <pointer>. If found, return 0, returns -1 if failure occurs.
|
|
Deallocate memory pointed to by <ptr>, which must have been allocated previously by <this->malloc>.
|
|
Allocate <nbytes>, but don't give them any initial value.
|
|
Returns a reference to the underlying memory pool.
|
|
Returns a pointer to the lock used to provide mutual exclusion to an <ACE_Malloc> allocator.
|
|
Initialize the Malloc pool.
|
|
Change the protection of the pages of the mapped region to <prot> starting at <addr> up to <len> bytes.
|
|
Change the protection of the pages of the mapped region to <prot> starting at <this->base_addr_> up to <len> bytes. If <len> == -1 then change protection of all pages in the mapped region. |
|
Get Reference counter.
|
|
Release ref counter.
|
|
Releases resources allocated by <ACE_Malloc>.
|
|
Associate <name> with <pointer>. Assumes that locks are held by callers.
|
|
Try to locate <name>. If found, return the associated <ACE_Name_Node>, else returns 0 if can't find the <name>. Assumes that locks are held by callers. Remember to cast the return value to ACE_CB::ACE_Name_Node*. |
|
Deallocate memory. Assumes that locks are held by callers.
|
|
Allocate memory. Assumes that locks are held by callers.
|
|
Sync <len> bytes of the memory region to the backing store starting at <addr_>.
|
|
Sync <len> bytes of the memory region to the backing store starting at <this->base_addr_>. If <len> == -1 then sync the whole region. |
|
Associate <name> with <pointer>. Does not allow duplicate <name>/<pointer> associations. Returns 0 if successfully binds (1) a previously unbound <name>, 1 if trying to bind a previously bound <name>, or returns -1 if a resource failure occurs. When this call returns <pointer>'s value will always reference the void * that <name> is associated with. Thus, if the caller needs to use <pointer> (e.g., to free it) a copy must be maintained by the caller. |
|
Unbind (remove) one association of <name> to <pointer>. Returns the value of pointer in case the caller needs to deallocate memory. If you want to remove all occurrences of <name> you'll need to call this method multiple times until it fails... |
|
Unbind (remove) the name from the map. Don't return the pointer to the caller. If you want to remove all occurrences of <name> you'll need to call this method multiple times until it fails... |
|
|
|
|
|
Declare the dynamic allocation hooks.
|
|
Pointer to the control block that is stored in memory controlled by <MEMORY_POOL>.
|
|
Lock that ensures mutual exclusion for the <MEMORY_POOL>.
|
|
Pool of memory used by <ACE_Malloc> to manage its freestore.
|