that’s my first post here; I am working with Unity for about a month. So far I did not encountered any bigger problems which couldn’t be solved by searching the net. But now I am stuck.
I am using editor version 2023.1.10f1 with URP, my game is 2D has tilemaps with
Shadowcaster2D
on them. It looks great, but I get two groups of memory leak warnings when
Shadowcaster2D
is active and running:
0x00000130a8506953 (Mono JIT Code) Unity.Collections.NativeArray`1<UnityEngine.Vector2>:Allocate (int,Unity.Collections.Allocator,Unity.Collections.NativeArray`1<UnityEngine.Vector2>&)
0x00000130a8506573 (Mono JIT Code) Unity.Collections.NativeArray`1<UnityEngine.Vector2>:.ctor (int,Unity.Collections.Allocator,Unity.Collections.NativeArrayOptions)
0x00000130a8500923 (Mono JIT Code) UnityEngine.Rendering.Universal.ShadowUtility:ClipEdges (Unity.Collections.NativeArray`1<UnityEngine.Vector3>,Unity.Collections.NativeArray`1<UnityEngine.Rendering.Universal.ShadowEdge>,Unity.Collections.NativeArray`1<int>,Unity.Collections.NativeArray`1<bool>,single,Unity.Collections.NativeArray`1<UnityEngine.Vector3>&,Unity.Collections.NativeArray`1<UnityEngine.Rendering.Universal.ShadowEdge>&,Unity.Collections.NativeArray`1<int>&) (at ./Library/PackageCache/[email protected]/Runtime/2D/Shadows/ShadowProvider/ShadowUtility.cs:671)
0x00000130a84f7613 (Mono JIT Code) UnityEngine.Rendering.Universal.ShadowMesh2D:SetShape (Unity.Collections.NativeArray`1<UnityEngine.Vector3>,Unity.Collections.NativeArray`1<int>,Unity.Collections.NativeArray`1<single>,UnityEngine.Matrix4x4,UnityEngine.Rendering.Universal.ShadowShape2D/WindingOrder,bool,bool) (at ./Library/PackageCache/[email protected]/Runtime/2D/Shadows/ShadowProvider/ShadowMesh2D.cs:273)
0x00000130a84ee04d (Mono JIT Code) UnityEngine.Rendering.Universal.ShadowShape2DProvider_Collider2D:CalculateShadows (UnityEngine.Collider2D,UnityEngine.Rendering.Universal.ShadowShape2D,UnityEngine.Bounds) (at ./Library/PackageCache/[email protected]/Runtime/2D/Shadows/ShadowProvider/Providers/ShadowShape2DProvider_Collider.cs:328)
0x00000130a84e9863 (Mono JIT Code) UnityEngine.Rendering.Universal.ShadowShape2DProvider_Collider2D:OnBeforeRender (UnityEngine.Component modreq(System.Runtime.InteropServices.InAttribute)&,UnityEngine.Bounds modreq(System.Runtime.InteropServices.InAttribute)&,UnityEngine.Rendering.Universal.ShadowShape2D) (at ./Library/PackageCache/[email protected]/Runtime/2D/Shadows/ShadowProvider/Providers/ShadowShape2DProvider_Collider.cs:360)
0x00000130a84e9512 (Mono JIT Code) UnityEngine.Rendering.Universal.ShapeProviderUtility:CallOnBeforeRender (UnityEngine.Rendering.Universal.ShadowShape2DProvider,UnityEngine.Component,UnityEngine.Rendering.Universal.ShadowMesh2D,UnityEngine.Bounds) (at ./Library/PackageCache/[email protected]/Runtime/2D/Shadows/ShadowProvider/ShapeProviderUtility.cs:19)
0x00000130a84e39cb (Mono JIT Code) UnityEngine.Rendering.Universal.Render2DLightingPass:CallOnBeforeRender (UnityEngine.Camera,UnityEngine.Rendering.Universal.ILight2DCullResult) (at ./Library/PackageCache/[email protected]/Runtime/2D/Passes/Render2DLightingPass.cs:417)
0x00000130a84d35f3 (Mono JIT Code) UnityEngine.Rendering.Universal.Render2DLightingPass:Execute (UnityEngine.Rendering.ScriptableRenderContext,UnityEngine.Rendering.Universal.RenderingData&) (at ./Library/PackageCache/[email protected]/Runtime/2D/Passes/Render2DLightingPass.cs:467)
0x00000130a84c29f8 (Mono JIT Code) UnityEngine.Rendering.Universal.ScriptableRenderer:ExecuteRenderPass (UnityEngine.Rendering.ScriptableRenderContext,UnityEngine.Rendering.Universal.ScriptableRenderPass,UnityEngine.Rendering.Universal.RenderingData&) (at ./Library/PackageCache/[email protected]/Runtime/ScriptableRenderer.cs:1581)
0x00000130a84c17db (Mono JIT Code) UnityEngine.Rendering.Universal.ScriptableRenderer:ExecuteBlock (int,UnityEngine.Rendering.Universal.ScriptableRenderer/RenderBlocks&,UnityEngine.Rendering.ScriptableRenderContext,UnityEngine.Rendering.Universal.RenderingData&,bool) (at ./Library/PackageCache/[email protected]/Runtime/ScriptableRenderer.cs:1537)
0x00000130a84ac92b (Mono JIT Code) UnityEngine.Rendering.Universal.ScriptableRenderer:Execute (UnityEngine.Rendering.ScriptableRenderContext,UnityEngine.Rendering
Seems to be in 15.0.6/Runtime/2D/Shadows/ShadowProvider/ShadowUtility.cs on line 671;
the other leak is detected on line 669
.
I cannot make it out in the memory profiler, but I am new to these tools, so probably I simply did not see the obvious.
The leaks even seem to appear in the editor.
What I am not sure about: I only get the leak info when I start my game (not build and run, just the play button in the editor) - is the call stack only analyzed at game start? Because all unused assets are getting unloaded and memory management then sees what’s still left? I would rather expect this at the end when I stop the game.
If this is considered a bug, how to submit it? I found the Issue Tracker, but there are no buttons to submit anything. Is that because I am new here?
Chris