AMS is an automatically managed but non-moving pool class. It should be used instead of AMC (Automatic Mostly-Copying) for blocks that need to be automatically managed, but cannot be moved.
AMS does not use generational garbage collection, but when creating a pool you use a generation chain to specify the capacity and mortality of a single “generation”. These numbers are used to schedule the collection of the whole pool.
Note
AMS is likely to be useful as a step in integrating a program with the MPS. It allows you to work on scanning (and investigate errors resulting from underscanning) without having to deal with objects moving as well. When you are confident that scanning is correct, you can switch to AMC (Automatic Mostly-Copying).
AMS is not currently suitable for production use. However, it could be developed into a solid mark-and-sweep pool. If you have a use case that needs this, contact us.
#include "mpscams.h"
Return the pool class for an AMS (Automatic Mark & Sweep) pool.
When creating an AMS 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_ams(), 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_ams(),
mps_fmt_t fmt,
mps_chain_t chain)
A debugging version of the AMS pool class.
When creating a debugging AMS pool, mps_pool_create_k() requires three keyword arguments: MPS_KEY_FORMAT and MPS_KEY_CHAIN are as described above, and MPS_KEY_POOL_DEBUG_OPTIONS specifies the debugging options. See mps_debug_option_s.
Deprecated
starting with version 1.112.
When using mps_pool_create(), pass the format, chain, and debugging options like this:
mps_res_t mps_pool_create(mps_pool_t *pool_o, mps_arena_t arena,
mps_class_t mps_class_ams_debug(),
mps_debug_option_s debug_option,
mps_fmt_t fmt,
mps_chain_t chain)