Marmos
v juptune
v asn1
v lang
v ast
v Classes
v Enums
v ir
v parser
v Enums
v Structs
v core
v crypto
v keyexchange
v memory
v data
v alphabet
v buffer
v json
v builder
v parser
v Enums
v Structs
v serialise
v Structs
v Templates
v pem
v Enums
v Structs

Functions MemoryBlockPool.preallocateBlocks

1
2
3
4
5
6
module juptune.core.ds.block;

Result preallocateBlocks(
    ulong powerOfTwo, 
    ulong blockCount
);

Documentation

Preallocates a certain amount of blocks from the system, at a specific power of two size.

Notes

This function does not attempt to clamp the powerOfTwoparameter to the nearest valid value. If this value is out of range, an assert will fail. Please use MIN_BLOCK_POWERand MAX_BLOCK_POWERto clamp the value and handle user input error cases.

Performance

Performance for this function is a little difficult to simplify, but it's roughly O(n) where nis the blockCountparameter.

The logic within this function scales at O(n), however the underlying calloccall depends on the libc/malloc-subsitute library that gets linked.

Params

Throws

MemoryBlockPool.Errors.outOfMemoryif there is not enough system memory to satisfy the request.

Returns

Result.noErrorif the allocation was successful.

See Also

MemoryBlockPool.allocate