UnityRef is currently in early development. Some features may be incomplete and/or not functioning.

UNITYREF

Your Pit Stop For Solving ANYTHING in Unity

optimization

Memory Explodes on Window Switch

Under Audit

memory managementperformancebuild optimization

Unity 2022.x - Unity 6.x

Published 3 days ago

Memory usage, particularly texture memory, significantly increases in the Unity editor when switching focus to another application while a game is running.

Issue

 When a game is running in the Unity editor, switching focus to a different window can cause a significant memory increase. A typical run of a game in the Unity editor might use around 3.17 GB total memory, with 1.05 GB allocated for textures. However, upon switching windows, the texture memory usage continuously grows to an unusually high amount, leading to an explosion in overall memory consumption.

Experimental Fixes
  • Verify Texture Streaming settings in Project Settings (Quality tab) and individual texture import settings to manage VRAM effectively.
  • Inspect custom Editor scripts for any logic that might continue to allocate memory or process resources when the Editor window is not in focus.
  • Temporarily disable any custom Editor window drawing or continuous GameObject updates that occur when the Editor is in the background, to isolate the issue.

Editor's Note:

The above fixes have not been verified by our audit team yet. They are provided exclusively for your own technical research. We recommend creating a backup of your project before proceeding with any attempts. Utilize at your own discretion!

Related Posts Haven't quite found a solution to your problem? We think these posts might help you.

Content inspired by a Unity discussion post.