ACE_Obstack(3)

ACE_Obstack3

Define a simple "mark and release" memory allocation utility.

Usage

#include <ace/Obstack.h>
class ACE_Obstack
{
  public:
    ACE_Obstack (
        size_t size = 4096 - sizeof (ACE_Obchunk),
        ACE_Allocator *allocator_strategy = 0
        );
    ~ACE_Obstack (void);
    char *copy (const char *data, size_t len);
    void release (void);
    void dump (void) const;
    ACE_ALLOC_HOOK_DECLARE;
  protected:
    ACE_Allocator *allocator_strategy_;
    size_t size_;
};

Overview

The implementation is similar to the GNU obstack utility, which is used extensively in the GCC compiler.

Initialization and termination methods.

ACE_Obstack (
    size_t size = 4096 - sizeof (ACE_Obchunk),
    ACE_Allocator *allocator_strategy = 0
    );
~ACE_Obstack (void);
char *copy (const char *data, size_t len);

Copy the data into the current Obchunk.

void release (void);

"Release" the entire stack of Obchunks, putting it back on the free list.

void dump (void) const;

Dump the state of an object.

ACE_ALLOC_HOOK_DECLARE;

Declare the dynamic allocation hooks.

Don't change the order of the following two fields.

Head of the Obchunk chain. Pointer to the current Obchunk.

Library

ace

Author

Doug Schmidt

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