- A* version: [5.2.5]
- Unity version: [2022.3]
Steps to reproduce problem:
-Enter play mode.
-Modify a script and compile.
-Stop play mode.
-Exception, leaks generated from navmesh cut jobs.
So it appears that if a domain reload is pending, when playmode is stopped the error is generated. This can be traced using leak detection enabled in Unity. Please let me know if you would like the stack trace.
My Collections package is already on 2.5.1. Also to note that the scene is static when I stop play mode (no navmesh cuts changing state). Here is the stack trace:
Found 257 leak(s) from callstack:
0x00007ffbaacf1d85 (93a803b1ae31875abe23cf02b8cb44b) Unity.Collections.NativeQueue`1<int>..ctor (at E:/fps/Library/PackageCache/com.unity.burst@1.8.18/.Runtime/Library/PackageCache/com.unity.collections@2.5.1/Unity.Collections/NativeQueue.cs:48)
0x00007ffbaad02387 (93a803b1ae31875abe23cf02b8cb44b) andywiecko.BurstTriangulator.LowLevel.Unsafe.UnsafeTriangulator`5.PlantingSeedStep<int,Unity.Mathematics.int2,long,andywiecko.BurstTriangulator.LowLevel.Unsafe.TransformInt,andywiecko.BurstTriangulator.LowLevel.Unsafe.IntUtils>.PlantAuto (at E:/fps/Library/PackageCache/com.unity.burst@1.8.18/.Runtime/Library/PackageCache/com.arongranberg.astar@5.2.5/Core/Geometry/Triangulation/Triangulator.cs:2083)
0x00007ffbaad01bce (93a803b1ae31875abe23cf02b8cb44b) andywiecko.BurstTriangulator.LowLevel.Unsafe.UnsafeTriangulator`5.PlantingSeedStep<int,Unity.Mathematics.int2,long,andywiecko.BurstTriangulator.LowLevel.Unsafe.TransformInt,andywiecko.BurstTriangulator.LowLevel.Unsafe.IntUtils>.Execute (at E:/fps/Library/PackageCache/com.unity.burst@1.8.18/.Runtime/Library/PackageCache/com.arongranberg.astar@5.2.5/Core/Geometry/Triangulation/Triangulator.cs:1964)
0x00007ffbaad08e54 (93a803b1ae31875abe23cf02b8cb44b) andywiecko.BurstTriangulator.LowLevel.Unsafe.UnsafeTriangulator`5<int,Unity.Mathematics.int2,long,andywiecko.BurstTriangulator.LowLevel.Unsafe.TransformInt,andywiecko.BurstTriangulator.LowLevel.Unsafe.IntUtils>.Triangulate (at E:/fps/Library/PackageCache/com.unity.burst@1.8.18/.Runtime/Library/PackageCache/com.arongranberg.astar@5.2.5/Core/Geometry/Triangulation/Triangulator.cs:975)
0x00007ffbaace5a26 (93a803b1ae31875abe23cf02b8cb44b) Pathfinding.Graphs.Navmesh.TileHandler.Pathfinding.Graphs.Navmesh.CutTiles_00000ADC$BurstDirectCall.Invoke (at E:/fps/Library/PackageCache/com.unity.burst@1.8.18/.Runtime/unknown/unknown:0)
0x00007ffbaad0d462 (93a803b1ae31875abe23cf02b8cb44b) Unity.Jobs.IJobExtensions.JobStruct`1<Pathfinding.Graphs.Navmesh.TileCutter.JobCutTiles>.Execute(ref Pathfinding.Graphs.Navmesh.TileCutter.JobCutTiles data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex) -> void_1a17c9416545ae7079718413b8a5101d from UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (at E:/fps/Library/PackageCache/com.unity.burst@1.8.18/.Runtime/unknown/unknown:0)
0x00007ffbaad0c2ed (93a803b1ae31875abe23cf02b8cb44b) 21a76e848d144b130c0976e4adfb32af
0x00007ff646327a22 (Unity) ExecuteJob
0x00007ff646328e0f (Unity) ForwardJobToManaged
0x00007ff646324c3a (Unity) ujob_execute_job
0x00007ff646326619 (Unity) ujob_wait_for
0x00007ff646320957 (Unity) CompleteFenceInternal
0x00007ff6458088bf (Unity) JobHandle_CUSTOM_ScheduleBatchedJobsAndComplete
0x000001f91afcd85a (Mono JIT Code) (wrapper managed-to-native) Unity.Jobs.JobHandle:ScheduleBatchedJobsAndComplete (Unity.Jobs.JobHandle&)
0x000001f7e49f115b (Mono JIT Code) Unity.Jobs.JobHandle:Complete ()
0x000001f8e4697bd3 (Mono JIT Code) Pathfinding.Sync.Promise`1<Pathfinding.Graphs.Navmesh.TileCutter/TileCutterOutput>:Complete () (at ./Library/PackageCache/com.arongranberg.astar@5.2.5/Core/Sync/Promise.cs:40)
0x000001f8e468bd9b (Mono JIT Code) Pathfinding.Graphs.Navmesh.NavmeshUpdates/NavmeshUpdateSettings:ReloadDirtyTilesImmediately () (at ./Library/PackageCache/com.arongranberg.astar@5.2.5/Navmesh/NavmeshUpdates.cs:272)
0x000001f8e468babb (Mono JIT Code) Pathfinding.Graphs.Navmesh.NavmeshUpdates/NavmeshUpdateSettings:<ScheduleDirtyTilesReload>b__30_0 (Pathfinding.IWorkItemContext) (at ./Library/PackageCache/com.arongranberg.astar@5.2.5/Navmesh/NavmeshUpdates.cs:264)
0x000001f7e49f20bc (Mono JIT Code) Pathfinding.WorkItemProcessor:ProcessWorkItems (bool,bool) (at ./Library/PackageCache/com.arongranberg.astar@5.2.5/Core/Misc/WorkItemProcessor.cs:328)type or paste code here
I double checked the stack trace and does not directly point to navmesh cuts as I originally thought. I feel this will be a problem only working in the editor, but kind of annoying and will complicate any debugging in the future. Error happens every time so easy to reproduce if that helps.
That leak is definitely a unity bug. I thought it was the collections package upgrade that would fix it. But it’s possible that a unity upgrade is also required.
In any case, I don’t think it’s a leak that you have to worry about. I think Unity is just forgetting to free the last block from an internal cache.