Version: 2023.2
언어: 한국어
가비지 컬렉션 베스트 프랙티스
Dynamic heap allocator

Native memory

Note: The information on allocators in this section applies to native memory only and is not applicable to the managed heap, which is covered in the Managed memory section. This section assumes you have a general understanding of native memory management and allocators.

애플리케이션은 메모리 할당자를 사용하여 성능과 사용 가능한 메모리 공간의 균형을 유지합니다. 여유 메모리가 많은 애플리케이션은 씬과 프레임을 로드할 때 메모리 소모가 많더라도 더 빠른 할당자를 선호합니다. 그러나 애플리케이션에 제한된 메모리가 있는 경우 느린 할당자를 사용하더라도 해당 메모리를 효율적으로 사용해야 합니다. 다양한 프로젝트에서 최고의 성능을 얻을 수 있도록 Unity의 할당자를 각 애플리케이션의 크기와 요구 사항에 맞게 커스터마이즈할 수 있습니다.

Unity has five allocator types. Each type has a different algorithm for fitting allocations into blocks of memory, and is therefore useful for different allocations. The important difference between allocations is usually persistence, or allocation lifespan, which determines where an allocation should go. For example, a long-lived (persistent) allocation goes to the heap and bucket allocators, while short-lived allocations go to the threadsafe linear and TLS allocators.

다음 표에는 각 할당자 타입의 알고리즘과 용도가 나와 있습니다.

할당자 타입 알고리즘 용도
Dynamic heap 2단계 분리 맞춤(TLSF) • 메인 할당자
• Gfx 할당자
• 타입트리 할당자
• 파일 캐시 할당자
• 프로파일러 할당자
• 에디터 프로파일러 할당자(에디터 전용)
Bucket 고정된 크기의 무잠금 할당자 작은 할당을 위한 공유 할당자로 사용

• 메인 할당자
• Gfx 할당자
• 타입트리 할당자
• 파일 캐시 할당자
Dual thread 크기와 스레드 ID를 기반으로 할당을 리디렉션합니다. • 메인 할당자
• Gfx 할당자
• 타입트리 할당자
• 파일 캐시 할당자
Thread Local Storage (TLS) stack LIFO 스택 임시 할당
Threadsafe linear 라운드 로빈(Round robin) FIFO 잡에 데이터를 전달하기 위한 버퍼

Note: The examples in this documentation use the memory usage reports that are written to the log when you close the Player or Editor if you have used the -log-memory-performance-stats command line argument. To find your log files, follow the instructions on the log files page.

가비지 컬렉션 베스트 프랙티스
Dynamic heap allocator