OnixS C++ CME MDP Premium Market Data Handler 5.11.1
Users' manual and API documentation
Loading...
Searching...
No Matches
MemoryPoolSettings Class Reference

#include <OnixS/CME/MDH/MemoryPoolSettings.h>

Public Member Functions

 MemoryPoolSettings () noexcept=default
 MemoryPoolSettings (std::size_t blockIncrease, std::size_t increaseQty, std::size_t chunkSize, std::size_t chunkScaling)
std::size_t blockIncrease () const noexcept
void blockIncrease (std::size_t increase)
std::size_t increaseQty () const noexcept
void increaseQty (std::size_t qty)
std::size_t chunkSize () const noexcept
void chunkSize (std::size_t size)
std::size_t chunkScaling () const noexcept
void chunkScaling (std::size_t factor)

Detailed Description

These settings control allocation granularity, the range of block sizes cached by the pool, and how chunks of equally sized blocks grow as demand increases.

Note
Setters validate individual values. Relationships between values are validated when the memory pool is created.

Definition at line 36 of file MemoryPoolSettings.h.

Constructor & Destructor Documentation

◆ MemoryPoolSettings() [1/2]

MemoryPoolSettings ( )
defaultnoexcept

Creates settings with their default values.

Note
The defaults are a block increase of 48, an increase quantity of 32, a chunk size of 20, and a chunk scaling factor of 2.

◆ MemoryPoolSettings() [2/2]

MemoryPoolSettings ( std::size_t blockIncrease,
std::size_t increaseQty,
std::size_t chunkSize,
std::size_t chunkScaling )

Creates settings with the specified allocation and chunk-growth policy.

Parameters
blockIncreaseDifference in capacity between adjacent cached block-size classes.
increaseQtyNumber of cached block-size classes.
chunkSizeInitial number of blocks allocated per chunk.
chunkScalingFactor by which successive chunks grow.
Exceptions
std::out_of_rangeIf any parameter is zero.

Member Function Documentation

◆ blockIncrease() [1/2]

std::size_t blockIncrease ( ) const
inlinenoexcept

Returns the allocation granularity for memory blocks.

Returns
Value by which cached memory-block sizes are divisible.

Definition at line 56 of file MemoryPoolSettings.h.

◆ blockIncrease() [2/2]

void blockIncrease ( std::size_t increase)

Sets the allocation granularity for memory blocks.

Parameters
increaseValue by which cached memory-block sizes must be divisible.
Exceptions
std::out_of_rangeIf increase is zero.

◆ chunkScaling() [1/2]

std::size_t chunkScaling ( ) const
inlinenoexcept

Returns the factor used to grow successive chunks.

Returns
Multiplier applied when the memory pool allocates another chunk.

Definition at line 106 of file MemoryPoolSettings.h.

◆ chunkScaling() [2/2]

void chunkScaling ( std::size_t factor)

Sets the factor used to grow successive chunks.

Parameters
factorMultiplier applied when the memory pool allocates another chunk.
Exceptions
std::out_of_rangeIf factor is zero.

◆ chunkSize() [1/2]

std::size_t chunkSize ( ) const
inlinenoexcept

Returns the initial number of equally sized blocks allocated per chunk.

Returns
Initial number of blocks in a newly allocated chunk.

Definition at line 90 of file MemoryPoolSettings.h.

◆ chunkSize() [2/2]

void chunkSize ( std::size_t size)

Sets the initial number of equally sized blocks allocated per chunk.

Allocating blocks in chunks reduces the number of underlying memory allocations.

Parameters
sizeInitial number of blocks in a newly allocated chunk.
Exceptions
std::out_of_rangeIf size is zero.

◆ increaseQty() [1/2]

std::size_t increaseQty ( ) const
inlinenoexcept

Returns the number of block-size increments cached by the memory pool.

Requests no larger than blockIncrease() * increaseQty() can use cached blocks; larger requests are allocated without caching.

Returns
Number of cached block-size increments.

Definition at line 73 of file MemoryPoolSettings.h.

◆ increaseQty() [2/2]

void increaseQty ( std::size_t qty)

Sets the number of block-size increments cached by the memory pool.

Requests no larger than blockIncrease() * increaseQty() can use cached blocks; larger requests are allocated without caching.

Parameters
qtyNumber of cached block-size increments.
Exceptions
std::out_of_rangeIf qty is zero.