# Alloc Exe

### Signature

```csharp
u64 allocExe(u64 size)
```

### Description

Allocates executable memory from a pre-reserved 32MB memory region within the lower 32-bit address space, always aligned to the nearest 16 bytes.

This region is reserved before game execution. It is independent of the main allocation pool and cannot be used by [alloc](https://xeavin.gitbook.io/ff12-lua-loader/memory-save/functions/alloc "mention").

Allocations are served from this region until no suitable contiguous space remains. If the reserved region is exhausted, allocation falls back to the default allocator and may return addresses outside the 32-bit range.

Returns the starting address to the allocated memory, or `0` if allocation fails.

### Arguments

#### Size

The amount of memory to allocate, in bytes.

### Notes

{% hint style="warning" %}
The maximum amount of memory that can be allocated is 128 MB.
{% endhint %}

{% hint style="warning" %}
Always deallocate memory that is no longer used to avoid memory leaks.
{% endhint %}
