Memory Profiling - tracked a memory leak to a blank Native Object Name

I have been using the Memory Profiler package for the last couple days, trying to pin down a memory leak in my suite of games. The one very glaringly obvious culprit is an 8.0MB texture that appears after returning to a main menu after playing one of the games (see screenshot below).

The trouble is that the Native Object Name is blank, and I have no idea how to track where this texture is coming from. I call Resources.UnloadUnusedAssets when returning to the main menu, so I’m not sure why it would not get cleaned up.

Is there any way to get more information about a texture showing up in the memory snapshot using one of the other fields?

Hi there,
Is this perchance a snapshot made while profiling the game in Playmode, or is this from a build player?
If it is from the Editor, there is a chance that this is a Memory Leak in the Memory Profiler UI itself, that we have fixed already and will ship with com.unity.memoryprofiler@0.2.6-preview.1. More info on that can be found in this thread which was asking the same question.

In short:
If you create textures on the fly (i.e. not loading from file but maybe from the web or creating them newly in c#) you can assign a name to it via it’s .name property.
In this case, there is one reference to it i.e. the blue 1 in RefCount column that you can click on to see what references it. That might help you figure out where this came from too.

1 Like

Thanks for the info! This is a snapshot made while profiling the game in Play mode in editor, so it could be a leak in the memory profiler UI itself.

I did click on the ref count, and got this:


which I believe does confirm your answer.

1 Like

It does look like that yes :slight_smile:

1 Like

FYI, the fix for this has just landed with the release of com.unity.memoryprofiler@0.2.6-preview.1

1 Like

Great thanks for the update @MartinTilo !

1 Like