Allocator¶
| Spice | |
|---|---|
StorageReport struct¶
Summary of the allocator's free storage at a glance
StorageReportFull struct¶
Detailed report of the allocator's free storage, broken down per leaf bin
Allocator struct¶
An offset allocator that hands out regions from a fixed-size storage area using binned free lists. It manages offsets into an external storage block rather than memory itself, which makes it useful for sub-allocating GPU buffers or other contiguous resources.
Constructors¶
ctor¶
| Spice | |
|---|---|
Construct an allocator managing a storage area of the given size
Parameters
| Name | Type | Description |
|---|---|---|
size |
UInt32 |
Total size of the managed storage area |
maxAllocas |
UInt32 |
Maximum number of concurrent allocations to support (default: 128 * 1024) |
dtor¶
| Spice | |
|---|---|
Destruct the allocator, releasing its internal bookkeeping storage
Methods¶
allocate¶
| Spice | |
|---|---|
Allocate a region of the given size from the storage area
Parameters
| Name | Type | Description |
|---|---|---|
size |
UInt32 |
Size of the region to allocate |
Returns: Allocation — Allocation describing the reserved region
free¶
| Spice | |
|---|---|
Return a previously allocated region to the allocator
Parameters
| Name | Type | Description |
|---|---|---|
allocation |
Allocation |
Allocation to free |
Functions¶
getStorageReport¶
| Spice | |
|---|---|
Produce a summary report of the allocator's free storage
Returns: StorageReport — Storage report with total free space and largest free region
getStorageReportFull¶
| Spice | |
|---|---|
Produce a detailed report of the allocator's free storage, broken down per leaf bin
Returns: StorageReportFull — Full storage report