Version: 2017.3

MemorySnapshot

class in UnityEditor.MemoryProfiler

切换到手册

描述

MemorySnapshot 是一个用于帮助诊断内存使用情况的分析工具。

MemorySnapshot 以及 UnityEditor.MemoryProfiler.* 中的所有类型都是实验性 API,未来很可能发生显著变化。目前,只有基于 il2cpp 的播放器能够提供内存快照。编辑器和基于单声道的播放器不会响应对新快照的请求。

静态函数

RequestNewSnapshotRequests a new snapshot from the currently connected target of the profiler. Memory snapshots are supported on IL2CPP and Mono .NET 3.5 scripting backends. NOTE: Each snapshot consists of approximately one managed object per recorded managed object. Snapshots taken from the editor will contain the objects in all previous snapshots that have not yet been garbage-collected. Therefore, repeated snapshots of the editor may grow exponentially. If you no longer need an old snapshot it is therefore advisable to null all references to it and call GC.Collect() before taking another one.

Events

OnSnapshotReceived当新内存快照通过性能分析器连接传入时将触发的事件。它的参数将是 PackedMemorySnapshot。