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¶
Supports allocation via
mps_alloc()
and deallocation viamps_free()
.Does not support allocation via allocation points.
Does not support allocation frames.
Supports segregated allocation caches.
There are no garbage collections in this pool.
Blocks may not contain references to blocks in automatically managed pools (unless these are registered as roots).
Allocations may be variable in size.
The alignment of blocks is not configurable: it is the natural alignment of the platform (see
MPS_PF_ALIGN
).Blocks do not have dependent objects.
Blocks are not automatically reclaimed.
Blocks are not scanned.
Blocks are not protected by barriers (1).
Blocks do not move.
Blocks may not be registered for finalization.
Blocks must not belong to an object format.
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
andmaximum 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. Seemps_debug_option_s
.extend_size
,average_size
andmaximum_size
are as documented inmps_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.