NAME

ACE_Malloc - Define a C++ class that uses parameterized types to provide an extensible mechanism for encapsulating various of dynamic memory management strategies.

SYNOPSIS

#include <ace/Malloc_T.h>

template<ACE_MEM_POOL_1, class ACE_LOCK> class ACE_Malloc { public: friend class ACE_Malloc_Iterator<ACE_MEM_POOL_2, ACE_LOCK>; typedef ACE_MEM_POOL MEMORY_POOL; typedef ACE_MEM_POOL_OPTIONS MEMORY_POOL_OPTIONS; ACE_Malloc (LPCTSTR pool_name = 0); ACE_Malloc ( LPCTSTR pool_name, LPCTSTR lock_name, const ACE_MEM_POOL_OPTIONS *options = 0 ); ACE_Malloc ( LPCTSTR pool_name, LPCTSTR lock_name, const void *options = 0 ); ~ACE_Malloc (void); int remove (void); void *malloc (size_t nbytes); void *calloc (size_t nbytes, char initial_value = ' '); void free (void *ptr); MEMORY_POOL &memory_pool (void); int bind (const char *name, void *pointer, int duplicates = 0); int trybind (const char *name, void *&pointer); int find (const char *name, void *&pointer); int find (const char *name); int unbind (const char *name); int unbind (const char *name, void *&pointer); int sync (ssize_t len = -1, int flags = MS_SYNC); int sync (void *addr, size_t len, int flags = MS_SYNC); int protect (ssize_t len = -1, int prot = PROT_RDWR); int protect (void *addr, size_t len, int prot = PROT_RDWR); ssize_t avail_chunks (size_t size) const; void print_stats (void) const; void dump (void) const; ACE_ALLOC_HOOK_DECLARE; private: int open (void); int shared_bind (const char *name, void *pointer); ACE_Name_Node *shared_find (const char *name); void *shared_malloc (size_t nbytes); void shared_free (void *ptr); ACE_Control_Block *cb_ptr_; MEMORY_POOL memory_pool_; ACE_LOCK lock_; };

DESCRIPTION

This class can be configured flexibly with different MEMORY_POOL strategies and different types of ACE_LOCK strategies.

Initialization and termination methods.

ACE_Malloc (LPCTSTR pool_name = 0);

ACE_Malloc (
    LPCTSTR pool_name,
    LPCTSTR lock_name,
    const ACE_MEM_POOL_OPTIONS *options = 0
    );

ACE_Malloc (
    LPCTSTR pool_name,
    LPCTSTR lock_name,
    const void *options = 0
    );

~ACE_Malloc (void);

int remove (void);

Memory management

void *malloc (size_t nbytes);

void *calloc (size_t nbytes, char initial_value = '  ');

void free (void *ptr);

MEMORY_POOL &memory_pool (void);

Map manager like functions

int bind (const char *name, void *pointer, int duplicates = 0);

int trybind (const char *name, void *&pointer);

int find (const char *name, void *&pointer);

int find (const char *name);

int unbind (const char *name);

int unbind (const char *name, void *&pointer);

Protection and

sync" (i.e., flushing data to backing store)."
int sync (ssize_t len = -1, int flags = MS_SYNC);

int sync (void *addr, size_t len, int flags = MS_SYNC);

int protect (ssize_t len = -1, int prot = PROT_RDWR);

int protect (void *addr, size_t len, int prot = PROT_RDWR);

ssize_t avail_chunks (size_t size) const;

void print_stats (void) const;

void dump (void) const;

ACE_ALLOC_HOOK_DECLARE;

AUTHOR

Doug Schmidt and Irfan Pyarali

LIBRARY

ace