Search Issue Tracker
Won't Fix
Votes
35
Found in
2021.3.17f1
2022.3.3f1
2022.3.4f1
2023.1.4f1
Issue ID
UUM-43067
Regression
No
OnImportAsset leaks 5GB of memory
Run the Test.cs by importing a empty .foo file and unity will never dispose of 5GB of allocated data
!image-2023-07-17-17-19-53-321.png!
-
stocksweeper
Apr 02, 2024 08:09
How to fix 5GB memory leak error?
-
Rocketman_Dan
Oct 16, 2023 18:49
How the hell is this a won't fix? Saying it's not a memory leak is meaningless if the behaviour is the same.
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Resolution Note:
Looking into this with the memory profiler it doesn't seem like this is a leak. I simplified to just use buffers with no GCHandles and the same behavior is there.
It's reserving managed memory, but empty. If I run an import the first import takes a second, but the second file is near instantaneous. It reuses that reserved memory space.
It makes sense why you'd want that model for importers. If I'm going to import 100 files of roughly the same size, I want it to reserve the memory once and then reuse it.
I looked into it for a day and a half and there doesn't appear to be a way to compact that memory space. There are longer term plans to make this architecture work better, but we don't really have a simple fix.
The recommended way to deal with this is to use buffered file streams and object pooling to control the amount of memory being used. I talked to Alexandre and he said they have a solution for now.