Search Issue Tracker
By Design
Votes
0
Found in
2017.3.0a6
2017.3.0f2
Issue ID
977938
Regression
No
PackedMemorySnapshot: RequestNewSnapshot freezes editor for a bit
Reproduction steps:
1. Download user's attached project and open in Unity
2. Open scene Scene
3. Open BugReport -> Open TestCode Window
4. Press "Capture memory 'Editor'" button several times to simulate a bigger snapshot being captured
Expected:
Receiving a large PackedMemorySnapshot should not cause the editor to freeze for several seconds.
The UnityEditor.MemoryProfiler API should provide a callback, beside "OnSnapshotReceived", to allow reporting the "snapshot receiving progress".
Having functionality to report the progress would smooth out the problem of "OnSnapshotReceived" taking so much time.
Actual: Editor freezes (if the button is pressed more times, the freeze will last longer as the snapshot grows (the later is as expected))
Reproduced on: 2017.3.0a6; 2017.3.0a7; 2017.3.0p1; 2018.1.0b1
Not reproduced on: 2017.2.1p1; 2017.3.0a5
Regression introduced: 2017.3.0a6
Note: Blue rectangle in TestCode window shows the severity of the freeze
Answer:
We are working on improvements on the backend of this so it should get less severe at some point in the near future.
Regarding taking multiple snapshots from the Editor taking longer and longer:
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.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [Android][Vulkan] Crash on /system/lib/libandroid.so (ANativeWindow_setBuffersGeometry+4) when the Vulkan Graphics API is used
- Event handlers are preventing operations when trying to copy or paste HTML text in the WebGL Player
- [macOS] Crash on __pthread_kill when Exporting a Package while another export is in progress
- Crash on TransformAccessDestroyCallback when removing a URP Decal Projector component from a parent GameObject that had a URP Decal Projector child GameObject
- An added component is being removed form the prefab when reimporting the prefab
Resolution Note:
Due to having to walk native allocations we need to effectively stop all systems that allocate, plus the scripting back-end in order to capture the current state, as such not having the editor "freeze" when taking a memory snapshot is problematic, we are planning to look again at this when more of the code for the Memory Profiler API will move to C#