---
title: IUnityMemoryManager API reference
product: Unity Editor
version: '6000.0'
latest_version: '7000.0'
status: This page documents version 6000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/ko-kr/engine/6000.0/manual/scripting/compilation-and-code-reload/plug-ins/native-plugin-interface/low-level-native-plugin-memory-manager-api-reference
latest_url: https://docs.unity.com/ko-kr/engine/7000.0/manual/scripting/compilation-and-code-reload/plug-ins/native-plugin-interface/low-level-native-plugin-memory-manager-api-reference.md
generated_at: 2026-11-19T17:21:12.107Z
locale: ko-kr
---

# IUnityMemoryManager API reference

> 네이티브 플러그인에서 메모리 관리자 API 사용합니다.

이 페이지는 `IUnityMemoryManager` 인터페이스에 대한 API 레퍼런스를 제공합니다.

## CreateAllocator##createallocator

### 선언##declaration

`UnityAllocator* (UNITY_INTERFACE_API * CreateAllocator)(const char* areaName, const char* objectName);`

### 파라미터##parameters

| **파라미터**                    | **설명**                   |
| --------------------------- | ------------------------ |
| **const char* area이름*\*     | 이 할당자의 광범위한 카테고리의 이름입니다. |
| **const char* objectName*\* | 이 특정 할당자의 이름입니다.         |

### 설명##description

메모리 블록을 할당할 수 있는 새 할당자 오브젝트를 생성합니다.

## DestroyAllocator##destroyallocator

### 선언##declaration

`void(UNITY_INTERFACE_API * DestroyAllocator)(UnityAllocator * allocator);`

### 파라미터##parameters

| **파라미터**                        | **설명**      |
| ------------------------------- | ----------- |
| **UnityAllocator \* allocator** | 삭제할 할당자입니다. |

### 설명##description

기존 Allocator 오브젝트를 삭제합니다.

## Allocate##allocate

### 선언##declaration

`void* (UNITY_INTERFACE_API * Allocate)(UnityAllocator * allocator, size_t size, size_t align, const char* file, int32_t line);`

### 파라미터##parameters

| **파라미터**                        | **설명**                                                         |
| ------------------------------- | -------------------------------------------------------------- |
| **UnityAllocator \* allocator** | 할당에 사용할 할당자입니다.                                                |
| **size\_t size**                | 할당할 메모리 양(바이트)입니다.                                             |
| **size\_t align**               | 결과 포인터의 메모리 주소 정렬입니다.                                          |
| **const char* 파일*\*             | 이 할당을 위한 호출이 발생한 소스 파일의 경로입니다. 여기서 사전 정의된 매크로 \_파일\_을 사용합니다.   |
| **int32\_t line**               | 이 할당을 위한 호출이 발생한 소스 파일의 줄 번호입니다. 여기서 사전 정의된 매크로 \_라인\_을 사용합니다. |

### 설명##description

기존 할당자를 사용하여 메모리 블록을 할당합니다. 이 메서드는 새로 할당된 메모리에 대한 포인터를 반환합니다.

## Deallocate##deallocate

### 선언##declaration

`void(UNITY_INTERFACE_API * Deallocate)(UnityAllocator * allocator, void* ptr, const char* file, int32_t line);`

### 파라미터##parameters

| **파라미터**                        | **설명**                                                            |
| ------------------------------- | ----------------------------------------------------------------- |
| **UnityAllocator \* allocator** | 할당 해제에 사용할 할당자입니다.                                                |
| **void* ptr\**                  | 할당 해제할 메모리에 대한 포인터입니다.                                            |
| **const char* 파일*\*             | 이 할당 해제를 위한 호출이 발생한 소스 파일의 경로입니다. 여기서 사전 정의된 매크로 \_파일\_을 사용합니다.   |
| **int32\_t line**               | 이 할당 해제를 위한 호출이 발생한 소스 파일의 줄 번호입니다. 여기서 사전 정의된 매크로 \_라인\_을 사용합니다. |

### 설명##description

지정된 포인터가 가리키는 메모리를 할당 해제합니다. 이는 포인터를 null 설정하지 않습니다.

## 재할당##reallocate

### 선언##declaration

`void* (UNITY_INTERFACE_API * Reallocate)(UnityAllocator * allocator, void* ptr, size_t size, size_t align, const char* file, int32_t line);`

### 파라미터##parameters

| **파라미터**                        | **설명**                                                          |
| ------------------------------- | --------------------------------------------------------------- |
| **UnityAllocator \* allocator** | 재할당 작업에 사용할 할당자입니다.                                             |
| **void* ptr\**                  | 할당 해제할 메모리에 대한 포인터입니다.                                          |
| **size\_t size**                | 할당할 메모리 양(바이트)입니다.                                              |
| **size\_t align**               | 결과 포인터의 메모리 주소 정렬입니다.                                           |
| **const char* 파일*\*             | 이 재할당을 위한 호출이 발생한 소스 파일의 경로입니다. 여기서 사전 정의된 매크로 \_파일\_을 사용합니다.   |
| **int32\_t line**               | 이 재할당을 위한 호출이 발생한 소스 파일의 줄 번호입니다. 여기서 사전 정의된 매크로 \_라인\_을 사용합니다. |

### 설명##description

기존 포인터를 다른 메모리 블록을 가리키도록 재할당합니다.

## 구현 예시##implementation-example

다음은 `IUnityMemoryManager` 인터페이스의 구현 예제입니다.

```lang-cs
#include "IUnityInterface.h"
#include "IUnityMemoryManager.h"
#include <cstdint>

static IUnityMemoryManager* s_MemoryManager = NULL;
static UnityAllocator* s_Alloc = NULL;

extern "C" void Unity_INTERFACE_EXPORT Unity_INTERFACE_API UnityPluginLoad(IUnityInterfaces * unityInterfaces)
{
    s_MemoryManager = unityInterfaces->Get<IUnityMemoryManager>();
    if (s_MemoryManager  == NULL)
	반환;

    // Create an allocator. 이를 통해 스냅샷을 찍을 때 프로파일러에서 할당 루트를 볼 수 있습니다. Plug-ins-native 아래 - 플러그인 백엔드 할당자
   // All memory allocated here also goes under kMemNativePlugin
    s_Alloc = s_MemoryManager->CreateAllocator("plug-ins-native", "Plugin Backend Allocator");
}

extern "C" void Unity_INTERFACE_EXPORT Unity_INTERFACE_API UnityPluginUnload()
{
    //Free allocator
    s_MemoryManager->DestroyAllocator(s_Alloc);
    s_Alloc = NULL;
    s_MemoryManager = NULL;
}

void DoMemoryOperations()
{  
    // Allocate 1KB memory
    void* mem = s_MemoryManager->Allocate(s_Alloc, 1 * 1024, 16, __FILE__, __LINE__);
     // Reallocate the same pointer with 2KB
    mem = s_MemManager->Reallocate(s_Alloc, mem, 2 * 1024, 16, __FILE__, __LINE__);
    // Delete allocated memory
    s_MemoryManager->Deallocate(s_Alloc, mem, __FILE__, __LINE__);
}
```

## 추가 리소스##additional-resources

* [로우레벨 네이티브 플러그인 렌더링 확장 기능](/engine/6000.0/manual/scripting/compilation-and-code-reload/plug-ins/native-plugin-interface/low-level-native-plugin-rendering-extensions.md)
* [로우레벨 네이티브 플러그인 셰이더 컴파일러 액세스](/engine/6000.0/manual/scripting/compilation-and-code-reload/plug-ins/native-plugin-interface/low-level-native-plugin-shader-compiler-access.md)
* [로우레벨 네이티브 플러그인 메모리 관리자 API](/engine/6000.0/manual/scripting/compilation-and-code-reload/plug-ins/native-plugin-interface/low-level-native-plugin-memory-manager-api.md)
