# EnsureCapacity(int)

> Ensures that the buffer has at least the specified capacity.

## Definition

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

```csharp
public void EnsureCapacity(int length)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The buffer capacity is ensured to be at least this big.

### Remarks

If `length` is greater than the current [DynamicBuffer\<T>.Capacity](/engine/7000.0/script-reference/unity/entities/dynamicbuffer1/capacity.md) of this buffer and greater than the capacity reserved with [InternalBufferCapacityAttribute](/engine/7000.0/script-reference/unity/entities/internalbuffercapacityattribute.md), this function allocates a new memory block and copies the current buffer to it. The number of elements in the buffer remains unchanged.
