Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Free

Frees an allocation.
Read time 1 minuteLast updated 10 days ago

Definition

  • Type: Method
  • Namespace: Unity.Collections
  • Assembly: UnityEngine.ManagedKernelModule

Free(AllocatorHandle, void*, int, int, int)

Frees an allocation.
public static void Free(AllocatorManager.AllocatorHandle handle, void* pointer, int itemSizeInBytes, int alignmentInBytes, int items = 1)

Parameters

A handle to the allocator.

pointer

A pointer to the allocated memory.

itemSizeInBytes

The size in bytes of the allocation.

alignmentInBytes

The alignment in bytes (must be a power of two).

items

The number of values that the memory was allocated for.

Remarks

For some allocators, the size of the allocation must be known to properly deallocate. Other allocators only need the pointer when deallocating and so will ignore
itemSizeInBytes
,
alignmentInBytes
and
items
.

Free(AllocatorHandle, void*)

Frees an allocation.
public static void Free(AllocatorManager.AllocatorHandle handle, void* pointer)

Parameters

A handle to the allocator.

pointer

A pointer to the allocated memory.

Free<T>(AllocatorHandle, `<>*, int)

Frees an allocation.
public static void Free<T>(AllocatorManager.AllocatorHandle handle, T* pointer, int items = 1) where T : unmanaged

Parameters

A handle to the allocator.

pointer

A pointer to the allocated memory.

items

The number of values that the memory was allocated for.

Remarks

For some allocators, the size of the allocation must be known to properly deallocate. Other allocators only need the pointer when deallocating and so will ignore
T
and
items
.