Unity Game Optimization
上QQ阅读APP看书,第一时间看更新

Allocation Callstack

By activating the Allocation Callstack option, Unity Profiler will collect more info about the game's memory allocations without requiring Deep Profile:

If the option is enabled, you can click on the red boxes representing memory allocations and Profiler will show you the origin and the cause of that memory allocation:

In Hierarchy view, instead, you still need to select an allocation call. Then, you need to switch to Show Related Objects in the drop-down menu in the upper-right corner and then select one of the N/A objects. After that, you'll see Callstack info in the box underneath.

We will talk more about memory allocations in Chapter 8Masterful Memory Management.

At the time of writing, in Unity 2019.1, Allocation Callstack works only when profiling in the Editor.