### Navigation

- index
- next |
- previous |
- Memory Pool System 1.111.0 documentation »
- Pool reference »

# 5. AMCZ (Automatic Mostly-Copying Zero-rank)

AMCZ is a general-purpose automatically managed pool class for leaf objects (“zero-rank” objects that contain no references).

It is otherwise identical to AMC (Automatic Mostly-Copying).

AMCZ is intended for “simple” objects like numbers, characters, and strings. Segregating these objects into one or more AMCZ pools avoids the cost of scanning them that would be incurred if they were interleaved in a pool with objects containing references. It may also simplify the scanning of the objects that are left behind.

See Segregation of objects for an example.

## 5.1. AMCZ properties

AMCZ is identical to AMC (Automatic Mostly-Copying), except that:

- Blocks may not contain references to blocks in automatically managed pools.
- Blocks are not scanned. A consequence of this is that the pool’s object format need not provide a scan method.
- Blocks are not protected by barriers(1).

## 5.2. AMCZ interface

    #include "mpscamc.h"

mps_class_t `mps_class_amcz`(void)

  Return the pool class for an AMCZ (Automatic Mostly-Copying Zero-rank) pool.

  When creating an AMCZ pool, `mps_pool_create()` takes two extra arguments:

      mps_res_t mps_pool_create(mps_pool_t *pool_o, mps_arena_t arena,
                                mps_class_t mps_class_amcz(),
                                mps_fmt_t fmt,
                                mps_chain_t chain)

  `fmt` specifies the object format for the objects allocated in the pool. The format must provide a skip method, a forward method, an is-forwarded method and a padding method.

  `chain` specifies the generation chain for the pool.

### Navigation

- index
- next |
- previous |
- Memory Pool System 1.111.0 documentation »
- Pool reference »