Search Unity

LWRP constantly creating several KB of garbage per frame

Discussion in 'Universal Render Pipeline' started by SVC-Games, Jun 6, 2019.

  1. SVC-Games

    SVC-Games

    Joined:
    May 21, 2013
    Posts:
    137
    So I was profiling a test project and noticed GC Allocs on "RenderPipelineManager.DoRenderLoop_Internal()"

    Just to be sure I created a new LWRP project (Unity 2019.1.5) and just run the Sample Scene. And yes, I'm having 3.6 KB of garbage generated every frame.

    Furthermore "ScriptableRuntimeReflectionSystemWrapper.Internal_ScriptableRuntimeReflectionSystemWrapper_TickRealtimeProbes()" is generating 40 B per frame.

    And sure enough, spikes ocur every now and then... Again, this is a brand new project, running the Sample Scene.

    I assume this is a bug of LWRP? For something that is "production ready" this seems like an issue...
     
  2. SVC-Games

    SVC-Games

    Joined:
    May 21, 2013
    Posts:
    137
    Here's a screenshot of the profiler:

    GC Alloc LWRP.JPG

    As you can see it's definetly a LWRP problem. It doesn't seem to be much, but just in a few seconds you end up with MB of garbage which will prompt the GC collector and stuttering
     
  3. minearjade

    minearjade

    Joined:
    Sep 29, 2017
    Posts:
    2
    Can confirm, this is a headache.
     
    SVC-Games likes this.
  4. robrab2000-aa

    robrab2000-aa

    Joined:
    Feb 8, 2019
    Posts:
    117
    I'm finding this too. only 1.5kb but its enough to cause stutters in webgl :(
     
    Last edited: Sep 17, 2019
    SVC-Games likes this.
  5. robrab2000-aa

    robrab2000-aa

    Joined:
    Feb 8, 2019
    Posts:
    117
    What version of SRP and LWRP are you using?
     
  6. Revolter

    Revolter

    Joined:
    Mar 15, 2014
    Posts:
    216
    I think they fixed this in LWRP 7.0+ version, mostly.
     
    robrab2000-aa likes this.
  7. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    422
    Looks like this is back in URP 7.1.8 and now does 251.7kb per frame, consistently.
     
  8. Elvar_Orn

    Elvar_Orn

    Unity Technologies

    Joined:
    Dec 9, 2019
    Posts:
    162
    Interesting!
    I'm running the URP Template Scene with 7.1.8 and not seeing any garbage being created.

    Can you file a bug with a repro so I can take a look?
     
  9. DatThax

    DatThax

    Joined:
    Jun 18, 2019
    Posts:
    10
    With URP 7.2.1, in the URP sample scene, adding a 2D renderer, setting the main camera to use it and adding a single 2D point light causes about 36B to be allocated per frame. It seems the more lights, the more garbage is created.

    I didn't change any materials to use Sprite-Lit-Default.

    This causes noticeable spikes when running a 2D game with 2D lighting.

    Edit: Running Unity 2020.1.0a23 for this test, but it also happens using 2019.3.2f1.
    Overall, performance is quite a bit better in 0a23 though.
     
  10. Aykutkaraca

    Aykutkaraca

    Joined:
    Jan 4, 2018
    Posts:
    33
    running 2019.3.6f1 and I have the same issue. I have URP 7.1.8.
     
  11. Shaunyowns

    Shaunyowns

    Joined:
    Nov 4, 2019
    Posts:
    328
    Hey @Aykutkaraca, can you file a bug with repro please?