> ## 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.

# ApuAlloc

> ApuAlloc

# ApuAlloc

APU 물리적 메모리를 할당합니다.

## Syntax

```cpp theme={null}
HRESULT ApuAlloc(  
         void** virtualAddress,  
         APU_ADDRESS* physicalAddress,  
         UINT32 sizeInBytes,  
         UINT32 alignmentInBytes = 4,  
         UINT32 flags = APU_ALLOC_CACHED  
)  
```

### Parameters

*virtualAddress*   \_Result\_nullonfailure\_ \_Outptr\_result\_bytebuffer\_(sizeInBytes)\
Type: void\*\*

반환되는 가상 주소입니다.

*physicalAddress*   \_Result\_zeroonfailure\_ \_Out\_opt\_\
Type: APU\_ADDRESS\*

반환되는 `APU_ADDRESS`이며 APU에서 사용됩니다.

*sizeInBytes*   \_In\_\
Type: UINT32

할당 크기(바이트 단위)입니다.

*alignmentInBytes*   \_In\_\
Type: UINT32

정렬(바이트 단위)입니다. 2의 거듭제곱이어야 하며 4 이상이어야 합니다.

*flags*\
Type: UINT32

할당 플래그: `APU_ALLOC_CACHED` 또는 `APU_ALLOC_NONCACHED`.

### Return value

Type: HRESULT

이 메서드는 다음 값을 반환할 수 있습니다:

| 반환 코드 | 설명 |
| :- | :- |
| S\_OK | 성공 |
| E\_INVALIDARG | 유효하지 않은 인수. 예: virtual address == nullptr, size == 0, alignment == 0, (alignment & 0x3) != 0, (alignment & (alignment - 1)) != 0, 또는 유효하지 않은 flags 값 |
| E\_OUTOFMEMORY | 메모리 할당 실패 |

## Remarks

반환되는 가상 주소와 물리적 주소는 동일한 주소 공간의 서로 다른 뷰를 나타냅니다. 하나를 해제하면 다른 하나도 무효화됩니다. 할당을 해제하려면 [ApuFree](https://docs.xbox.com/ko/reference/audio/apu/functions/apufree.md)를 사용하세요.

## Requirements

**Header:** apu.h

**Library:** acphal.lib

**지원 플랫폼:** XBOX One 제품군 콘솔 및 XBOX Series 콘솔

## 개념 설명서

* [XMA2 개요](https://docs.xbox.com/ko/build/console-features/audio/overviews/xma2-overview.md)

## See also

[ApuFree](https://docs.xbox.com/ko/reference/audio/apu/functions/apufree.md)\
[APU](https://docs.xbox.com/ko/reference/audio/apu/apu_members.md)


## Related topics

- [ApuFree](https://docs.xbox.com/ko/reference/audio/apu/functions/apufree.md)
- [ApuMapApuAddress](https://docs.xbox.com/ko/reference/audio/apu/functions/apumapapuaddress.md)
- [XMA2 개요](https://docs.xbox.com/ko/build/console-features/audio/overviews/xma2-overview.md)
- [ApuMapVirtualAddress](https://docs.xbox.com/ko/reference/audio/apu/functions/apumapvirtualaddress.md)
- [ApuIsVirtualAddressValid](https://docs.xbox.com/ko/reference/audio/apu/functions/apuisvirtualaddressvalid.md)
