- Home /
Why does Unity's memory usage increase continuously while the profiler reports static usage?
I'm trying to debug what appears to be a memory leak of some sort. When I start a particular scene in my game (running in the editor on a Win XP box) after maybe 30 minutes sitting still in the scene, the editor crashes with a message saying something like "fatal error in gc too many heap sections".
If I look at Windows Task Manager while the game is running I see the Unity.exe Mem Usage start around 200MB and slowly and continuously build up to about 600MB before it finally crashes. So, I immediately think memory leak. The thing that's confusing me is that I also pull up the Unity Profiler and look at the memory usage in there. It shows a flat 100MB used from the time the game starts to the time it crashes.
I know I still need to investigate my Update() functions to make sure there's no weird object creation going on there. Though, I can't think what I might be doing that the GC wouldn't be able to take care of on its own.
Regardless, I don't understand why I only see memory increase in the Task Manager but not the Unity Profiler. My instinct says that's a leak in Unity itself rather than anything I've done, but I don't know for sure.
Any ideas?
casimps1: I suggest that you submit a bug report with your project.
I noticed the same problem, you can create a clean scene on a clean project with no assets and still when the standalone player runs, memory starts building up, at a very slow pace (about 4$$anonymous$$/5sec) Even calling System.GC.Collect() periodically has no effect on this issue.
Does the same thing happen when you build the project? If not, it might have something to do with the added overhead from the Unity editor.
It does, actually, I tested a builded standalone windows client, not playing inside Unity.
Ow this looks terribly bad. What version of Unity are you using?
Your answer
Follow this Question
Related Questions
Memory Leak Help 2 Answers
Performance going down over time 2 Answers
When a animation is loaded to memory? 0 Answers
Unable to free resources from memory 0 Answers