rsc3/doc-schelp/HelpSource/Classes/ContiguousBlockAllocator.schelp

35 lines
1.3 KiB
Text
Raw Normal View History

2022-08-24 13:53:18 +00:00
class:: ContiguousBlockAllocator
summary:: for better handling of dynamic allocation
related:: Classes/Server, Classes/PowerOfTwoAllocator
categories:: Control
description::
A more robust replacement for the default server block allocator, link::Classes/PowerOfTwoAllocator::. May be used in the link::Classes/Server:: class to allocate audio/control bus numbers and buffer numbers.
To configure a server to use ContiguousBlockAllocator, execute the following:
code::
aServer.options.blockAllocClass = ContiguousBlockAllocator;
::
Normally you will not need to address the allocators directly. However, ContiguousBlockAllocator adds one feature not present in PowerOfTwoAllocator, namely the emphasis::reserve:: method.
ClassMethods::
method::new
Create a new allocator with emphasis::size:: slots. You may block off the first emphasis::pos:: slots (the server's audioBusAllocator does this to reserve the hardware input and output buses).
InstanceMethods::
private::prReserve, prSplit
method::alloc
Return the starting index of a free block that is emphasis::n:: slots wide. The default is 1 slot.
method::free
Free a previously allocated block starting at emphasis::address::.
method::reserve
Mark a specific range of addresses as used so that the alloc method will not return any addresses within that range.