# AllocateNativeArray<T>(int)

> Allocate a NativeArray of type T from memory that's guaranteed to remain valid until ScratchpadAllocator.Rewind is called on the Scratchpad.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule

```csharp
public NativeArray<T> AllocateNativeArray<T>(int length) where T : unmanaged
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The number of items in the NativeArray.

### Returns

| Type                                                                                 | Description              |
| ------------------------------------------------------------------------------------ | ------------------------ |
| [NativeArray\<T>](/engine/7000.0/script-reference/unity/collections/nativearray1.md) | Returns the NativeArray. |

### Remarks

This memory isn't shared between threads and you don't need to Dispose the NativeArray so it's allocated. You can't Dispose the memory to free it: it's automatically freed when [ScratchpadAllocator.Rewind](/engine/7000.0/script-reference/unity/entities/scratchpadallocator/rewind.md) is called.
