Documentation

Unity Engine


Unity Engine


ScratchpadAllocator

A fast allocator which allocates memory from its scratchpad.
Read time 1 minuteLast updated a day ago

Definition

[BurstCompile]public struct ScratchpadAllocator : AllocatorManager.IAllocator, IDisposable

Properties

Property

Description

FunctionAll allocators must implement this property, in order to be installed in the custom allocator table.
HandleRetrieve 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.
IsAutoDisposeCheck whether this allocator will automatically dispose allocations.
IsCustomAllocatorCheck whether this allocator is a custom allocator.
ToAllocatorRetrieve the Allocator associated with this allocator handle.

Methods

Method

Description

AllocateNativeArrayAllocate a NativeArray of type T from memory that's guaranteed to remain valid until ScratchpadAllocator.Rewind is called on the Scratchpad.
AllocateNativeListAllocate a NativeList of type T from memory that's guaranteed to remain valid until ScratchpadAllocator.Rewind is called on the Scratchpad.
DisposeDispose the allocator.
GetAvailableBytesGet remaining bytes that are available to allocate.
InitializeInitializes the allocator. Must be called before first use.
RewindRewind the allocator; invalidate all allocations made from it.
TryTry to allocate, free, or reallocate a block of memory.