It's Leaking about 20 MiB Memory / Second

Hi!

Not a showstopper issue, but I noticed that the 5.5.0xf3Linux release loses about 20 MiB of memory each second when playing in the editor (the profiler panel says it happens in the ‘GfxDriver’ module).

This memory isn’t freed again when leaving play mode or at any other time until I quit the Unity editor.

It’s all fine when I build a standalone Linux player executable and run that though :slight_smile:

Eek, that’s concerning - we’ll investigate.
Do you see the same behavior (e.g. in top or similar) when the unity profiler isn’t running?

Yes, that’s how I first noticed it (via Conky and KSysGuard)

The memory is accounted for in the profiler’s ‘Used Total’ and ‘Gfx Driver’ counters. The ‘TotalSystem Memory Usage’ starts climbing from 0 once the ‘Used Total’ goes over 4 GiB:

The memory is not accounted for in the ‘Detailed’ view of Unity’s profiler at all.

When I quit Unity, it freezes for several seconds and I can watch the memory slowly drop back to normal. Not sure if anything can be read into this, but it might indicate that Unity is keeping track of that memory somewhere after all:

If I instead kill -9 it (thus letting the kernel’s memory manager release the process’ memory), the memory usage drops like this:

Nothing worthwhile in Editor.log, sorry.

Hm, I don’t see the same behavior here, for a simple project.
It’s not potentially “leaked” texture or mesh data from your project? (i.e. How to Remove Textures from Memory (Downloaded During Play) - Questions & Answers - Unity Discussions )

My project contains a lot of static geometry, but does not dynamically create textures or geometry apart from a single, reused 1x1 texture for camera fading.

I’ve done some more tests:

  • No leak if I just look around in the ‘Scene’ panel
  • No leak if I drag the active camera around in the scene with the ‘Game’ panel visible
  • Leak if I enter play mode
  • Leak if I enter play mode with no active camera

By process of elimination, I can limit it to a single static mesh with the Standard Shader in specular mode that causes it:

I also upgraded to Unity 5.5.0xp1Linux today and the leak does not happen there. Just to be sure, I opened my project in Unity 5.5.0xf3Linux again and the leak is still occurring there.

If you’re interested, I can try to build a reproduction case. In any case, I’ll go and see if I can find something in the release notes that might have to do with this leak :slight_smile: