> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Retorno de chamada XMEMALLOC_ROUTINE

> Retorno de chamada XMEMALLOC_ROUTINE

# Retorno de chamada XMEMALLOC\_ROUTINE

Define a sintaxe das rotinas de alocação de memória, [XMemAlloc](https://docs.xbox.com/pt-BR/reference/system/xmem/functions/xmemalloc.md) e `XMemAllocDefault`.

## Sintaxe

```cpp theme={null}
PVOID XMEMALLOC_ROUTINE(  
         SIZE_T Size,  
         ULONGLONG Attributes  
)  
```

### Parâmetros

*Size*   \_In\_\
Tipo: SIZE\_T

O tamanho do bloco de memória que está sendo solicitado, em bytes.

*Attributes*   \_In\_\
Tipo: ULONGLONG

Os atributos da alocação de memória. Para obter mais informações, consulte [XALLOC\_ATTRIBUTES](https://docs.xbox.com/pt-BR/reference/system/xmem/structs/xalloc_attributes.md).

### Valor retornado

Tipo: PVOID

Um ponteiro para a memória alocada, se bem-sucedido; caso contrário, `NULL`.

## Comentários

Essa definição de função é usada na estrutura [XMEM\_ALLOCATION\_HOOKS](https://docs.xbox.com/pt-BR/reference/system/xmem/structs/xmem_allocation_hooks.md) para definir as funções [XMemAlloc](https://docs.xbox.com/pt-BR/reference/system/xmem/functions/xmemalloc.md) e `XMemAllocDefault`. Da mesma forma, a definição de função [XMEMFREE\_ROUTINE](https://docs.xbox.com/pt-BR/reference/system/xmem/functions/xmemfree_routine.md) é usada para definir as funções [XMemFree](https://docs.xbox.com/pt-BR/reference/system/xmem/functions/xmemfree.md) e `XMemFreeDefault`.

> [!NOTE]
>
> O código-fonte da implementação padrão de `XMemAlloc` é instalado como parte do Microsoft Game Development Kit (GDK). Para obter mais informações, consulte a função `XMemAllocDefault` em `\GXDK\gameKit\Source\amd64\heap.c`.

## Requisitos

**Cabeçalho:** xmem.h

**Biblioteca:** xmem.lib

**Plataformas compatíveis:** consoles da família XBOX One e consoles XBOX Series

## Confira também

[Diagnóstico e rastreamento de memória](https://docs.xbox.com/pt-BR/build/console-features/memory/system-memory-diagnostics.md)\
[XMem](https://docs.xbox.com/pt-BR/reference/system/xmem/xmem_members.md)\
[XMemAllocDefault](https://docs.xbox.com/pt-BR/reference/system/xmem/functions/xmemallocdefault.md)


## Related topics

- [Retorno de chamada XMEMFREE_ROUTINE](https://docs.xbox.com/pt-BR/reference/system/xmem/functions/xmemfree_routine.md)
- [Retorno de chamada PHEAP_TRACK_ALLOC_ROUTINE](https://docs.xbox.com/pt-BR/reference/system/xmem/functions/pheap_track_alloc_routine.md)
- [Retorno de chamada PHEAP_TRACK_FREE_ROUTINE](https://docs.xbox.com/pt-BR/reference/system/xmem/functions/pheap_track_free_routine.md)
- [Retorno de chamada PHEAP_TRACK_REALLOC_ROUTINE](https://docs.xbox.com/pt-BR/reference/system/xmem/functions/pheap_track_realloc_routine.md)
- [XAsyncBlock](https://docs.xbox.com/pt-BR/reference/system/xasync/structs/xasyncblock.md)
