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:

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_k() requires two keyword arguments:

For example:

MPS_ARGS_BEGIN(args) {
    MPS_ARGS_ADD(args, MPS_KEY_CHAIN, chain);
    MPS_ARGS_ADD(args, MPS_KEY_FORMAT, fmt);
    MPS_ARGS_DONE(args);
    res = mps_pool_create_k(&pool, arena, mps_class_amcz(), args);
} MPS_ARGS_END(args);

Deprecated

starting with version 1.112.

When using mps_pool_create(), pass the format and chain like this:

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)