ScratchpadAllocator
A fast allocator which allocates memory from its scratchpad.
Read time 1 minuteLast updated a day ago
Definition
- Type: Struct
- Namespace: Unity.Entities
- Assembly: UnityEngine.EntitiesModule
- Implements: IAllocator, IDisposable
[BurstCompile]public struct ScratchpadAllocator : AllocatorManager.IAllocator, IDisposable
Properties
Property | Description |
|---|---|
| Function | All allocators must implement this property, in order to be installed in the custom allocator table. |
| Handle | Retrieve the AllocatorHandle associated with this allocator. The handle is used as an index into a global table, for times when a reference to the allocator object isn't available. |
| IsAutoDispose | Check whether this allocator will automatically dispose allocations. |
| IsCustomAllocator | Check whether this allocator is a custom allocator. |
| ToAllocator | Retrieve the Allocator associated with this allocator handle. |
Methods
Method | Description |
|---|---|
| AllocateNativeArray | Allocate a NativeArray of type T from memory that's guaranteed to remain valid until ScratchpadAllocator.Rewind is called on the Scratchpad. |
| AllocateNativeList | Allocate a NativeList of type T from memory that's guaranteed to remain valid until ScratchpadAllocator.Rewind is called on the Scratchpad. |
| Dispose | Dispose the allocator. |
| GetAvailableBytes | Get remaining bytes that are available to allocate. |
| Initialize | Initializes the allocator. Must be called before first use. |
| Rewind | Rewind the allocator; invalidate all allocations made from it. |
| Try | Try to allocate, free, or reallocate a block of memory. |