官术网_书友最值得收藏!

  • Unity Game Optimization
  • Dr. Davide Aversa Chris Dickinson
  • 294字
  • 2021-06-24 12:12:58

The Memory area

The Memory area allows us to inspect the memory usage of the application in Breakdown View in the following two modes: 

  • Simple mode
  • Detailed mode

Simple mode provides only a high-level overview of the memory consumption of subsystems. This include Unity's low-level Engine, the Mono framework (total heap size that is being watched by the garbage collector), graphical assets, audio assets and buffers, and even memory used to store data collected by the Profiler.

Detailed mode shows memory consumption of individual GameObjects and MonoBehaviours for both their native and managed representations. It also has a column explaining the reason why an object may be consuming memory and when it might be deallocated.

The garbage collector is a common feature provided by C#—the Unity's scripting language of choice—that automatically releases any memory we have allocated to store data; but, if it is handled poorly, it has the potential to stall our application for brief moments. This topic, and many more related topics, such as native and managed memory spaces, will be explored in  Chapter 8, Masterful Memory Management .

Note that information only appears in Detailed mode through manual sampling by clicking on the Take Sample <TargetName> button. This is the only way to gather information when using Detailed mode, since performing this kind of analysis automatically for each update would be prohibitively expensive:

Breakdown View also provides a button labelled Gather Object References, which can gather more in-depth memory information pertaining to some objects.

The Memory area will be a useful tool to use when we dive into the complexities of memory management, native versus managed memory, and the garbage collector in Chapter 8, Masterful Memory Management.

主站蜘蛛池模板: 泸州市| 海晏县| 无棣县| 金沙县| 襄垣县| 华池县| 绥江县| 怀柔区| 浦县| 伊春市| 万宁市| 英超| 汝南县| 柯坪县| 黎川县| 桃源县| 依安县| 会泽县| 霍林郭勒市| 日土县| 利川市| 井研县| 彭山县| 涪陵区| 大石桥市| 铜山县| 台北市| 鸡东县| 沂南县| 竹北市| 宝应县| 芜湖市| 南皮县| 盘山县| 瑞昌市| 铜川市| 洪江市| 房山区| 三穗县| 阳春市| 文昌市|