ACE_New_Allocator(3)

ACE_New_Allocator3

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

Usage

#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;
};

Overview

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;

Library

ace

Author

Doug Schmidt and Irfan Pyarali

From libace-doc 5.0.7-4 in Debian 2.2 (Potato). Parsed by carta from the page's man source.