123456module juptune.core.ds.block;
Result preallocateBlocks(
ulong powerOfTwo,
ulong blockCount
);
Preallocates a certain amount of blocks from the system, at a specific power of two size.
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 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.
MemoryBlockPool.Errors.outOfMemoryif there is not enough system memory to satisfy the request.
Result.noErrorif the allocation was successful.
MemoryBlockPool.allocate