Built in editor search causing native array memory leak

My editor is reporting a memory lead from built in search operations. I’m not sure exactly when it’s triggering – the native allocation log for this triggered when I exited play-mode. (I’ve never triggered a native allocation leak from within edit mode before, so I’m not sure if the check runs when exiting every domain reload or just when exiting play mode.) Naturally make sure you perform an editor search, I think I did mine in the project window although I don’t know if that’s significant at all… If I knew the exact steps to reproduce I would make a bug report.

I first saw this bug a couple days ago in 6.0.31, it’s also present in 6.0.32 (latest release at time of posting).

Found 1 leak(s) from callstack:
0x00000220149d5e3b (Mono JIT Code) Unity.Collections.NativeArray`1<UnityEditor.Search.SearchIndexEntry>:Allocate (int,Unity.Collections.Allocator,Unity.Collections.NativeArray`1<UnityEditor.Search.SearchIndexEntry>&)
0x00000220149d5b83 (Mono JIT Code) Unity.Collections.NativeArray`1<UnityEditor.Search.SearchIndexEntry>:.ctor (int,Unity.Collections.Allocator,Unity.Collections.NativeArrayOptions)
0x000002215a4addcb (Mono JIT Code) UnityEditor.Search.SearchNativeList`1<UnityEditor.Search.SearchIndexEntry>:.ctor (int,Unity.Collections.Allocator)
0x000002215a4b6a5b (Mono JIT Code) UnityEditor.Search.SearchIndexer:Merge (string[],UnityEditor.Search.SearchIndexer,int,System.Action`3<int, UnityEditor.Search.SearchIndexer, int>,UnityEditor.Search.SearchTask`1<UnityEditor.Search.TaskData>)
0x000002215a4b64a3 (Mono JIT Code) UnityEditor.Search.SearchDatabase/<>c__DisplayClass115_0:<MergeDocuments>b__0 ()
0x00000220149a58c1 (Mono JIT Code) UnityEditor.Search.SearchTask`1/<>c__DisplayClass46_0<T_REF>:<RunThread>b__0 ()
0x0000021f32fcf1d6 (Mono JIT Code) System.Threading.ThreadHelper:ThreadStart_Context (object)
0x0000021f32fce7be (Mono JIT Code) System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
0x0000021f32fce26b (Mono JIT Code) System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
0x0000021f32fce18b (Mono JIT Code) System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object)
0x0000021f32fcdf13 (Mono JIT Code) System.Threading.ThreadHelper:ThreadStart ()
0x0000021f39f5f6b6 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007ffaaf4b69ce (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445)
0x00007ffaaf3f8474 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3068)
0x00007ffaaf3fba0a (mono-2.0-bdwgc) mono_runtime_delegate_try_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:4456)
0x00007ffaaf42810d (mono-2.0-bdwgc) start_wrapper_internal (at C:/build/output/Unity-Technologies/mono/mono/metadata/threads.c:1296)
0x00007ffaaf4282ce (mono-2.0-bdwgc) start_wrapper (at C:/build/output/Unity-Technologies/mono/mono/metadata/threads.c:1348)
0x00007ffbca8b7374 (KERNEL32) BaseThreadInitThunk
0x00007ffbcaa9cc91 (ntdll) RtlUserThreadStart

Thanks for reporting we will look at this shortly.

If you find any repro steps, feel free to paste them in this thread or to log a bug.

Seb