---
name: "ACE_Obstack"
section: "3"
platform: "linux"
package: "libace-doc"
version: "5.0.7-4"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/ACE_Obstack"
---

# ACE\_Obstack(3)

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

## NAME

ACE\_Obstack -  Define a simple "mark and release" memory allocation utility.

## SYNOPSIS

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

## DESCRIPTION

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.

## AUTHOR

Doug Schmidt

## LIBRARY

ace
