NAME

ACE_New_Allocator - Defines a class that provided a simple implementation of memory allocation.

SYNOPSIS

#include <ace/Malloc.h>

class ACE_New_Allocator : public ACE_Allocator { public: virtual void *malloc (size_t nbytes); virtual void *calloc (size_t nbytes, char initial_value = ' '); virtual void free (void *ptr); virtual int remove (void); virtual int bind ( const char *name, void *pointer, int duplicates = 0 ); virtual int trybind (const char *name, void *&pointer); virtual int find (const char *name, void *&pointer); virtual int find (const char *name); virtual int unbind (const char *name); virtual int unbind (const char *name, void *&pointer); virtual int sync (ssize_t len = -1, int flags = MS_SYNC); virtual int sync (void *addr, size_t len, int flags = MS_SYNC); virtual int protect (ssize_t len = -1, int prot = PROT_RDWR); virtual int protect ( void *addr, size_t len, int prot = PROT_RDWR ); virtual void print_stats (void) const; virtual void dump (void) const; };

DESCRIPTION

This class uses the new/delete operators to allocate and free up memory. Please note that the only methods that are supported are malloc and free. All other methods are no-ops. If you require this functionality, please use: ACE_Allocator_Adapter ACE_Malloc ACE_LOCAL_MEMORY_POOL, MUTEX This will allow you to use the added functionality of bind/find/etc. while using the new/delete operators.

PUBLIC MEMBERS

virtual void *malloc (size_t nbytes);

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

virtual void free (void *ptr);

virtual int remove (void);

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

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

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

virtual int find (const char *name);

virtual int unbind (const char *name);

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

virtual int sync (ssize_t len = -1, int flags = MS_SYNC);

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

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

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

virtual void print_stats (void) const;

virtual void dump (void) const;

AUTHOR

Doug Schmidt and Irfan Pyarali

LIBRARY

ace