---
name: "ACE_Sbrk_Memory_Pool"
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_Sbrk_Memory_Pool"
---

# ACE\_Sbrk\_Memory\_Pool(3)

Make a memory pool that is based on sbrk(2).

## NAME

ACE\_Sbrk\_Memory\_Pool -  Make a memory pool that is based on [sbrk(2)](/sbrk/2.md).

## SYNOPSIS

```
#include <ace/ACE_Memory_Pool.h>
class ACE_Sbrk_Memory_Pool
{
  public:
    typedef ACE_Sbrk_Memory_Pool_Options OPTIONS;
    ACE_Sbrk_Memory_Pool (
        LPCTSTR backing_store_name = 0,
        const OPTIONS *options = 0
        );
    virtual ~ACE_Sbrk_Memory_Pool (void);
    virtual void *init_acquire (
        size_t nbytes,
        size_t &rounded_bytes,
        int &first_time
        );
    virtual void *acquire (size_t nbytes, size_t &rounded_bytes);
    virtual int release (void);
    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 dump (void) const;
    ACE_ALLOC_HOOK_DECLARE;
  protected:
    virtual size_t round_up (size_t nbytes);
};
```

## Implementor operations.

```
virtual void *init_acquire (
    size_t nbytes,
    size_t &rounded_bytes,
    int &first_time
    );
```

Ask system for initial chunk of local memory.

```
virtual void *acquire (size_t nbytes, size_t &rounded_bytes);
```

Acquire at least NBYTES from the memory pool.  ROUNDED\_BYTES is the actual number of bytes allocated.

```
virtual int release (void);
```

Instruct the memory pool to release all of its resources.

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

Sync len bytes of the memory region to the backing store starting at this-base\_addr\_.  If len == -1 then sync the whole region.

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

Sync len bytes of the memory region to the backing store starting at addr\_.

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

Change the protection of the pages of the mapped region to prot starting at this-base\_addr\_ up to len bytes.  If len == -1 then change protection of all pages in the mapped region.

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

Change the protection of the pages of the mapped region to prot starting at addr up to len bytes.

```
virtual void dump (void) const;
```

Dump the state of an object.

```
ACE_ALLOC_HOOK_DECLARE;
```

Declare the dynamic allocation hooks.

## AUTHOR

Doug Schmidt and Prashant Jain

## LIBRARY

ace
