Higher Memory Usage in 2020.2.6f1 vs 2019.4.15f1

Hi,

We’re in the process of upgrading our project to the latest version of Unity (2020.2.6f1 at the time of writing). Unfortunately, however, we’re seeing significantly higher memory usage on the player built with this version of Unity than we were on 2019.4.15f1, and running into Out of Memory situations that were fine before. I’m hoping someone knows what could be going on. This is especially apparent to us on the Nintendo Switch where, obviously, we’re more memory constrained to begin with.

One thing I’ve noticed is that, using the (package) memory profiler window, we are seeing much higher shader allocations on 2020.2 than on 2019.4. The main thing I’m looking to understand on this particular post is whether anything has changed in the reporting of shader memory usage between these platforms - i.e. is it possible that this is a red herring and really we’re just seeing more accurate results in the newer version than we were before (if so, it would indicate our issue is elsewhere).

Here is a pair of screenshots showing the exact same almost-empty project showing only Shaders in the memory profiler window, to highlight the difference between 2020.2 and 2019.4. The difference is much more extreme in our actual project, but this is a simpler case to demonstrate.

First, here is the Shader memory usage according to the memory profiler in 2019.4.15f1:

And here is the same view, but from 2020.2.6f1:

Again, this is an almost-empty project, but serves to show the disparity. Can someone from Unity weigh in to explain whether this is a real issue and showing a real increase in memory usage, or whether it’s the case that 2020.2.6f1 is just showing more accurate results and that, in fact, the real memory usage was always like this in either case.

Thanks for any help you can offer as this has really blocked forward momentum on this project for us.

Hi!
Please check if ShaderLab usage in the profiler is lower with 2020.2.6f1. It should be :slight_smile:
We fixed memory attribution to shaders - it now shows more accurate stats.

1 Like

It is smaller (but not to the same degree as the other side is now larger). I did wonder if that was the case, which is why I was querying if the new view is actually the real view or not. Thanks for the info. It would be really helpful if this was documented somewhere, so as not to cause other people alarm. If it is documented somewhere, can you link to it - because, man, I really searched and searched for it!

We also upgraded to URP around the same time, so it’s plausible that we’re seeing (considerably) increased ShaderLab memory from that process. I had assumed URP would be lighter-weight in general, but I’ll spend some time looking at why we’re now seeing shader bloat of about 4x.

There was also some memory not attributed to any asset or system in particular which got fixed with the same bug.
Anyway, it should be mentioned in the release notes.

The release notes for which version? It’s not clear to me exactly when this issue was fixed as I went directly from 2019.4.15f1 to 2020.2.6f1.

Shaders: Fixed shader memory being attributed to ShaderLab instead of individual shaders (1292198)