com.unity.perception icon indicating copy to clipboard operation
com.unity.perception copied to clipboard

Material Leak in LabelManager

Open nicoarnaise opened this issue 2 years ago • 2 comments

Hello, I was searching for a memory leak in my project using the memory profiler and I found a material leak. Since I am only using .sharedMaterials in my code, I did search the whole project for .materials references and I found one here.

https://github.com/Unity-Technologies/com.unity.perception/blob/fa182305196025965c4fd7aa501e9b7bb7c04f5e/com.unity.perception/Runtime/GroundTruth/Labeling/LabelManager.cs#L152

I am pretty sure we could use .sharedMaterials.Length instead and this should avoid creating orphan instances of each material the labeled object contains. What do you think ?

nicoarnaise avatar May 20 '22 09:05 nicoarnaise

Plus I found another material leak in the textureRandomizer example : (I created my own one to solve the issue) https://github.com/Unity-Technologies/com.unity.perception/blob/fa182305196025965c4fd7aa501e9b7bb7c04f5e/com.unity.perception/Runtime/Randomization/Randomizers/RandomizerExamples/Randomizers/TextureRandomizer.cs#L38

nicoarnaise avatar May 20 '22 09:05 nicoarnaise

@nicoarnaise thank you for sharing this with us. We will add it to our backlog and hopefully fix this soon.

StevenBorkman avatar May 20 '22 22:05 StevenBorkman

Hey all! The Perception team just released 🎉 Perception 1.0 🎉, a major update to the toolset! Along with all of the new major improvements, we have fixed a lot of other bugs that we have discovered along the way, including this one reported by you. Thanks for being an active user.

There are a bunch of cool features to check out such as ray tracing, depth, a new output format SOLO, normals, and more! Here is the full list of changes: Perception 1.0 Changelog

StevenBorkman avatar Nov 22 '22 18:11 StevenBorkman