ContiguousBlockAllocator:
Filter:
Classes | Control

ContiguousBlockAllocator : Object

for better handling of dynamic allocation
Source: Engine.sc

Description

The default allocator used in servers to allocate bus numbers and buffer numbers. Compared to its predecessor, PowerOfTwoAllocator, it can reserve a block of numbers at the beginning of its range, and it can offset its entire range of numbers to support multiple clientIDs.

Class Methods

ContiguousBlockAllocator.new(size, pos: 0, addrOffset: 0)

Create a new allocator with size slots. You may block off the first pos slots (the server's audioBusAllocator does this to reserve the hardware input and output buses).

Inherited class methods

Instance Methods

.size

the number of id numbers it can allocate

.pos

the allocator's offset for a reserved block (e.g. for hardware input and output buses).

.addrOffset

the offset of the allocator's address range, which is used to accomodate multiple clientIDs.

.alloc(n: 1)

Return the starting index of a free block that is n slots wide. The default is 1 slot.

.free(address)

Free a previously allocated block starting at address.

.reserve(address, size: 1, warn: true)

Mark a specific range of addresses as used so that the alloc method will not return any addresses within that range.

.debug(text)

post internal state of allocator for debugging.

Inherited instance methods

Undocumented instance methods

.top