Memory leak
4 years 4 months ago - 4 years 4 months ago #4150
by ghet
Memory leak was created by ghet
Hello,
Just discovered that there seems to be memory leak when using font materials as secondary term.
If you simply create or duplicate text object that has material as secondary term and look at material count in unity profiler you will see that every time you do that material count goes up by 1. If you destroy or remove these objects material count does not go down.
Therefore you have memory leak there with ever-creating materials.
See attached video showing this in action.
Best regards,
Ghet
Edit:
It seems that you are accessing fontMaterial at few places. See line 47 in LocalizeTarget_TextMeshPro_Label.cs and line 49 in LocalizeTarget_TextMeshPro_UGUI.cs.
By accessing fontMaterial you are creating a new instance of material every time. There should be used fontSharedMaterial instead.
Just discovered that there seems to be memory leak when using font materials as secondary term.
If you simply create or duplicate text object that has material as secondary term and look at material count in unity profiler you will see that every time you do that material count goes up by 1. If you destroy or remove these objects material count does not go down.
Therefore you have memory leak there with ever-creating materials.
See attached video showing this in action.
Best regards,
Ghet
Edit:
It seems that you are accessing fontMaterial at few places. See line 47 in LocalizeTarget_TextMeshPro_Label.cs and line 49 in LocalizeTarget_TextMeshPro_UGUI.cs.
By accessing fontMaterial you are creating a new instance of material every time. There should be used fontSharedMaterial instead.
Last edit: 4 years 4 months ago by ghet. Reason: Solution added
Please Log in or Create an account to join the conversation.
Time to create page: 0.133 seconds