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) | • メイン (Main) アロケーター • Gfx アロケーター • Typetree アロケーター • ファイルキャッシュ (File Cache) アロケーター • プロファイラー (Profiler) アロケーター • エディタープロファイラー (Editor Profiler) アロケーター (エディター上のみ) |
Bucket | 固定サイズのロックフリーアロケーター |
• メイン (Main) アロケーター • Gfx アロケーター • Typetree アロケーター • ファイルキャッシュ (File Cache) アロケーター |
Dual thread | サイズとスレッド ID に基づいて割り当てをリダイレクトする | • メイン (Main) アロケーター • Gfx アロケーター • Typetree アロケーター • ファイルキャッシュ (File Cache) アロケーター |
Thread Local Storage (TLS) stack | LIFO スタック | 一時割り当て |
Threadsafe linear | ラウンドロビン 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.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.