I’ve been having an issue with the editor where it gets progressively worse performance as I test my game, this is due to what seems to be a memory leak on from a texture.
From what I read, this is likely caused by a texture being marked as read-write enabled, and then not properly disposing of it after being in play mode? I went ahead and filtered all my textures in the project and whatever didn’t need to be read-write enabled, I disabled that option. The only thing that is read-write enabled from third-party software, are the icons from Umodeler asset, which do need to be read-write enabled.
That may be, but I have not heard of such a thing.
What I do know is that if you create new Texture2D() objects yourself, you are responsible for Destroy()-ing them, and then making sure nothing (such as an array or list) continues to reference them. The combination of Destroy() and removing of all references should enable garbage collection.
Are you creating any textures yourself? Are you sure to Destroy() them when done?
What Kurt said and also: these look like runtime created textures (created via new Texture2D ()) that no one ever set the .name property for.
If you could use the Memory Profiler package, the latest update to 0.5 clarifies this exact situation and the References (including managed references that are missing in the Profiler Module) or Editor hideflags. If you take a snapshot with the package of the Editor and open that immediately, you may also still be able to select these textures and see their content and values in the inspector to help you find their source.
If this is only happening in the Editor, there was also a texture leak in one of the source control Icons in the lower status bar of the editor that iirc should be fixed in latest patch/package releases so you may want to make sure your editor and packages are up to date.
I’ve just downloaded Memory Profiler, seems like a great tool! Since this is my first time using it, could you help me with process of debugging this problem?
Here’s what I see , Texture2D taking up almost 3 GB of memory -
Clicking on that reveals this info -
Seems the bigger chunks are coming from Playmaker, but I’m not creating or instancing and form of texture on any of FSMs. Each smaller chunk seems to be related to gizmo icons.
I can’t be too sure from these screenshots alone but if they all relate to Playmaker and Playmaker related gizmos, this might be worth reporting to the creator via the Asset Store and see if that can get sorted out?
Alright so I have to bring this thread back as I was able to capture a more severe memory usage than previously captured, as I let myself work in Unity without closing it for an extended period of time.
With filtering, the red marker represents Playmaker images, but the blue marker represents general Unity gizmos which are A LOT. And while I will be posting in the Playmaker forums again, I just wanted to know if that representation of the usage of Unity gizmos is normal (i.e. do yours look like that after having Unity open for 4+ hours)?
Taking Playmaker out of the equation, what could I possibly do to fix this (besides restarting Unity every couple of hours)? I’m already using the latest Unity LTS - 2020.3.26.