13. SNC (Stack No Checking)

SNC is a manually managed pool class that supports a stack-like protocol for allocation and deallocation using allocation frames on allocation points. See Allocation frames.

If mps_ap_frame_pop() is used on an allocation point in an SNC pool (after a corresponding call to mps_ap_frame_push()), then the objects affected by the pop are assumed to be dead, and are reclaimed by the collector without checking whether there are any references to them.

This pool class is intended to be used to implement stack languages like Forth and PostScript, where some objects are allocated in stack frames and are known to be dead when the stack is popped, because the language can ensure that objects that are kept alive when the stack is popped are copied to the heap.

13.1. SNC properties

13.2. SNC interface

#include "mpscsnc.h"
mps_pool_class_t mps_class_snc(void)

Return the pool class for an SNC (Stack No Check) pool.

When creating an SNC pool, mps_pool_create_k() requires one keyword argument:

For example:

MPS_ARGS_BEGIN(args) {
    MPS_ARGS_ADD(args, MPS_KEY_FORMAT, fmt);
    res = mps_pool_create_k(&pool, arena, mps_class_snc(), args);
} MPS_ARGS_END(args);

When creating an allocation point on an SNC pool, mps_ap_create_k() accepts one optional keyword argument:

For example:

MPS_ARGS_BEGIN(args) {
    MPS_ARGS_ADD(args, MPS_KEY_RANK, mps_rank_exact());
    res = mps_ap_create_k(&ap, awl_pool, args);
} MPS_ARGS_END(args);