# Allocate

> Returns an allocation from the allocator's internal buffer.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Collections.LowLevel.Unsafe](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe.md)
* **Assembly:** UnityEngine.ManagedKernelModule

## Allocate(int, int)

Returns an allocation from the allocator's internal buffer.

```csharp
public void* Allocate(int sizeInBytes, int alignmentInBytes)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The size of the new allocation.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The alignment of the new allocation.

### Returns

| Type                                                         | Description                      |
| ------------------------------------------------------------ | -------------------------------- |
| [void\*](https://learn.microsoft.com/dotnet/api/system.void) | A pointer to the new allocation. |

## Allocate\<T>(int)

Returns an allocation from the allocator's internal buffer.

```csharp
public void* Allocate<T>(int count = 1) where T : unmanaged
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The number of elements to allocate space for. Defaults to 1.

### Returns

| Type                                                         | Description                      |
| ------------------------------------------------------------ | -------------------------------- |
| [void\*](https://learn.microsoft.com/dotnet/api/system.void) | A pointer to the new allocation. |

### Remarks

The allocation size in bytes is at least `count * sizeof(T)`. The space consumed by the allocation may be a little larger than this size due to alignment.
