Search Issue Tracker

Won't Fix



Found in






Issue ID




SerializedFile metrics show different memory costs when using AssetBundle.LoadFromFile and AssetBundle.LoadFromStream

Asset Bundles


How to reproduce:
1. Open the user's attached project
2. Open scene Scenes/SampleScene
3. Go to AssetBundle -> Build
4. Open the Profiler (Window -> Analysis -> Profiler) and record profiling information
5. Select the Memory tab and change the chart from "Simple" to "Detailed"
6. Press the Play button
7. In the Game view, select "unload bundle and unused assets" and "load bundle from stream"
8. In the Profiler Memory tab, select Take Sample, and observe the SerializedFile memory metrics (under Other)
9. Exit Play mode and enter Play mode again
10. In the Game view, select "unload bundle and unused assets" and "load bundle from file"
11. Repeat step 8

Expected result: SerializedFile shows no difference in memory cost between loading from stream and file
Actual result: SerializedFile shows that loading from stream costs 100-200KB more than loading from file

Reproducible with: 2020.3.26f1, 2021.2.8f1, 2022.1.0b4, 2022.2.0a2
Could not test with: 2019.4.36f1 (Unknown managed type referenced: [UnityEditor.CoreModule] UnityEditorInternal.Profiling.CPUProfilerModule)

  1. Resolution Note:

    The size differs due to the buffered reader memory consumption which appears in the case of LoadFromStream. Furthermore unlike LoadFromFile the buffered reader will keep memory around until the managed stream is disposed.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.