10. MV (Manual Variable)

Deprecated

starting with version 1.111.

MVT (Manual Variable Temporal) or MVFF (Manual Variable First Fit) should be used instead.

MV is a general-purpose manually managed pool class that manages blocks of variable size.

10.1. MV properties

10.2. MV interface

#include "mpscmv.h"
mps_class_t mps_class_mv(void)

Return the pool class for an MV (Manual Variable) pool.

When creating an MV pool, mps_pool_create() takes three extra arguments:

mps_res_t mps_pool_create(mps_pool_t *pool_o, mps_arena_t arena,
                          mps_class_t mps_class_mv(),
                          mps_size_t extend_size,
                          mps_size_t average_size,
                          mps_size_t maximum_size)

extend_size is the size of segment that the pool will request from the arena.

average_size and maximum size are the predicted average and maximum size of blocks that will be allocated from the pool. These are hints to the MPS: the pool will be less efficient if these are wrong.

mps_class_t mps_class_mv_debug(void)

A debugging version of the MV pool class.

When creating a debugging MV pool, mps_pool_create() takes four extra arguments:

mps_res_t mps_pool_create(mps_pool_t *pool_o, mps_arena_t arena,
                          mps_class_t mps_class_mv_debug(),
                          mps_debug_option_s debug_option,
                          mps_size_t extend_size,
                          mps_size_t average_size,
                          mps_size_t maximum_size)

debug_option specifies the debugging options. See mps_debug_option_s.

extend_size, average_size and maximum_size are as documented in mps_class_mv().

10.3. MV introspection

#include "mpscmv.h"
size_t mps_mv_free_size(mps_pool_t pool)

Return the total amount of free space in an MV pool.

pool is the MV pool.

Returns the total free space in the pool, in bytes (1).

size_t mps_mv_size(mps_pool_t pool)

Return the total size of an MV pool.

pool is the MV pool.

Returns the total size of the pool, in bytes (1). This is the sum of allocated space and free space.