see previous discussion here Native Crash with Unity 6
Unity 6 (6000.0.24f1)
The crash happens in play mode, and also in after build. I can reproduce contantly, but not sure what actually causes it.
I have also tried disabling everything burst related in project setting and my code, but the crash persists.
Also should mention that there is no crash in previous Unity version i used, which was 2022.2.44f1
=================================================================
Managed Stacktrace:
=================================================================
at <unknown> <0xffffffff>
at Unity.Collections.LowLevel.Unsafe.UnsafeUtility:FreeTracked <0x0006c>
at Array:Resize <0x00182>
at Unmanaged:Free <0x0004a>
at Unity.Collections.AllocatorManager:TryLegacy <0x00192>
at Unity.Collections.AllocatorManager:Try <0x0003a>
at AllocatorHandle:Try <0x0005a>
at Unity.Collections.AllocatorManager:FreeBlock <0x0005a>
at Unity.Collections.AllocatorManager:Free <0x00092>
at Unity.Collections.AllocatorManager:Free <0x0003a>
at Unity.Collections.AllocatorManager:Free <0x00032>
at Unity.Collections.LowLevel.Unsafe.UnsafeList`1:Dispose <0x000aa>
at UnityEngine.Rendering.SmallIntegerArray:Dispose <0x0002a>
at UnityEngine.Rendering.CPUSharedInstanceData:Set <0x00472>
at UnityEngine.Rendering.CPUSharedInstanceData:SetDefault <0x000f2>
at UnityEngine.Rendering.CPUSharedInstanceData:AddNoGrow <0x000d2>
at ReallocateInstancesJob:Execute <0x00952>
at JobStruct`1:Execute <0x0001a>
at ExecuteJobFunction:invoke_void_T&_intptr_intptr_JobRanges&_int <0x000b9>
at <Module>:runtime_invoke_void__this___intptr&_intptr_intptr_intptr&_int <0x000b5>
at <unknown> <0xffffffff>
at Unity.Jobs.LowLevel.Unsafe.JobsUtility:Schedule_Injected <0x0006c>
at Unity.Jobs.LowLevel.Unsafe.JobsUtility:Schedule <0x0003a>
at Unity.Jobs.IJobExtensions:Run <0x000ba>
at UnityEngine.Rendering.InstanceDataSystem:ReallocateAndGetInstances <0x01dc2>
at UnityEngine.Rendering.RenderersBatchersContext:ReallocateAndGetInstances <0x00072>
at UnityEngine.Rendering.GPUResidentBatcher:UpdateRendererData <0x00422>
at <>c:<.cctor>b__34_0 <0x022d0>
at UnityEngine.Rendering.GPUDrivenCallbacks:InvokeGPUDrivenRendererDataNativeCallback <0x00036>
at <Module>:runtime_invoke_void_object_intptr&_object_object_object <0x0009c>
at <unknown> <0xffffffff>
at UnityEngine.Rendering.GPUDrivenProcessor:EnableGPUDrivenRenderingAndDispatchRendererData_Injected <0x00094>
at UnityEngine.Rendering.GPUDrivenProcessor:EnableGPUDrivenRenderingAndDispatchRendererData <0x000ba>
at UnityEngine.Rendering.GPUDrivenProcessor:EnableGPUDrivenRenderingAndDispatchRendererData <0x000fa>
at UnityEngine.Rendering.GPUResidentBatcher:UpdateRenderers <0x0009a>
at UnityEngine.Rendering.GPUResidentDrawer:ProcessRenderers <0x0048a>
at UnityEngine.Rendering.GPUResidentDrawer:PostPostLateUpdate <0x00d02>
at UnityEngine.Rendering.GPUResidentDrawer:PostPostLateUpdateStatic <0x0003a>
at System.Object:runtime_invoke_void__this__ <0x00087>
=================================================================
========== OUTPUTTING STACK TRACE ==================
0x00007FFED63B0547 (Unity) tlsf_free
0x00007FFED3EE03D0 (Unity) DynamicHeapAllocator::Deallocate
0x00007FFED3EE7B26 (Unity) DynamicHeapAllocator::TryDeallocate
0x00007FFED3EF1B70 (Unity) DualThreadAllocator<DynamicHeapAllocator>::TryDeallocate
0x00007FFED3EE8145 (Unity) MemoryManager::TryDeallocateWithLabel
0x00007FFED3EE9963 (Unity) free_alloc_internal
0x00007FFED3934B42 (Unity) UnsafeUtility::Free
0x00007FFED3822E87 (Unity) UnsafeUtility_CUSTOM_FreeTracked
0x000002A1C31F20BD (Mono JIT Code) (wrapper managed-to-native) Unity.Collections.LowLevel.Unsafe.UnsafeUtility:FreeTracked (void*,Unity.Collections.Allocator)
0x000002A1BF159E53 (Mono JIT Code) [.\Library\PackageCache\com.unity.collections\Unity.Collections\Memory.cs:90] Unity.Collections.Memory/Unmanaged/Array:Resize (void*,long,long,Unity.Collections.AllocatorManager/AllocatorHandle,long,int)
0x000002A1C31F28BB (Mono JIT Code) [.\Library\PackageCache\com.unity.collections\Unity.Collections\Memory.cs:28] Unity.Collections.Memory/Unmanaged:Free (void*,Unity.Collections.AllocatorManager/AllocatorHandle)
0x000002A1BF159A13 (Mono JIT Code) [.\Library\PackageCache\com.unity.collections\Unity.Collections\AllocatorManager.cs:1107] Unity.Collections.AllocatorManager:TryLegacy (Unity.Collections.AllocatorManager/Block&)
0x000002A1BF15966B (Mono JIT Code) [.\Library\PackageCache\com.unity.collections\Unity.Collections\AllocatorManager.cs:1129] Unity.Collections.AllocatorManager:Try (Unity.Collections.AllocatorManager/Block&)
0x000002A1BF1595CB (Mono JIT Code) [.\Library\PackageCache\com.unity.collections\Unity.Collections\AllocatorManager.cs:614] Unity.Collections.AllocatorManager/AllocatorHandle:Try (Unity.Collections.AllocatorManager/Block&)
0x000002A1C31F27FB (Mono JIT Code) [.\Library\PackageCache\com.unity.collections\Unity.Collections\AllocatorManager.cs:143] Unity.Collections.AllocatorManager:FreeBlock<Unity.Collections.AllocatorManager/AllocatorHandle> (Unity.Collections.AllocatorManager/AllocatorHandle&,Unity.Collections.AllocatorManager/Block&)
0x000002A1BF15A6F3 (Mono JIT Code) [.\Library\PackageCache\com.unity.collections\Unity.Collections\AllocatorManager.cs:157] Unity.Collections.AllocatorManager:Free<Unity.Collections.AllocatorManager/AllocatorHandle> (Unity.Collections.AllocatorManager/AllocatorHandle&,void*,int,int,int)
0x000002A1C31F9CEB (Mono JIT Code) [.\Library\PackageCache\com.unity.collections\Unity.Collections\AllocatorManager.cs:162] Unity.Collections.AllocatorManager:Free<Unity.Collections.AllocatorManager/AllocatorHandle, int> (Unity.Collections.AllocatorManager/AllocatorHandle&,int*,int)
0x000002A1F97A7E23 (Mono JIT Code) [.\Library\PackageCache\com.unity.collections\Unity.Collections\AllocatorManager.cs:226] Unity.Collections.AllocatorManager:Free<int> (Unity.Collections.AllocatorManager/AllocatorHandle,int*,int)
0x000002A1F97A7D2B (Mono JIT Code) [.\Library\PackageCache\com.unity.collections\Unity.Collections\UnsafeList.cs:273] Unity.Collections.LowLevel.Unsafe.UnsafeList`1<int>:Dispose ()
0x000002A1F996D30B (Mono JIT Code) [.\Library\PackageCache\com.unity.render-pipelines.core\Runtime\GPUDriven\InstanceData\InstanceData.cs:679] UnityEngine.Rendering.SmallIntegerArray:Dispose ()
0x000002A2049A3483 (Mono JIT Code) [.\Library\PackageCache\com.unity.render-pipelines.core\Runtime\GPUDriven\InstanceData\InstanceData.cs:532] UnityEngine.Rendering.CPUSharedInstanceData:Set (UnityEngine.Rendering.SharedInstanceHandle,int,UnityEngine.Rendering.SmallIntegerArray&,int,UnityEngine.Rendering.AABB&,UnityEngine.Rendering.TransformUpdateFlags,UnityEngine.Rendering.InstanceFlags,uint,int,int)
0x000002A2049A2FC3 (Mono JIT Code) [.\Library\PackageCache\com.unity.render-pipelines.core\Runtime\GPUDriven\InstanceData\InstanceData.cs:544] UnityEngine.Rendering.CPUSharedInstanceData:SetDefault (UnityEngine.Rendering.SharedInstanceHandle)
0x000002A2049A1E33 (Mono JIT Code) [.\Library\PackageCache\com.unity.render-pipelines.core\Runtime\GPUDriven\InstanceData\InstanceData.cs:469] UnityEngine.Rendering.CPUSharedInstanceData:AddNoGrow (UnityEngine.Rendering.SharedInstanceHandle)
0x000002A2049A0C33 (Mono JIT Code) [.\Library\PackageCache\com.unity.render-pipelines.core\Runtime\GPUDriven\InstanceData\InstanceDataSystem.Jobs.cs:565] UnityEngine.Rendering.InstanceDataSystem/ReallocateInstancesJob:Execute ()
0x000002A2049A00FB (Mono JIT Code) Unity.Jobs.IJobExtensions/JobStruct`1<UnityEngine.Rendering.InstanceDataSystem/ReallocateInstancesJob>:Execute (UnityEngine.Rendering.InstanceDataSystem/ReallocateInstancesJob&,intptr,intptr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,int)
0x000002A2049A01FA (Mono JIT Code) (wrapper delegate-invoke) Unity.Jobs.IJobExtensions/JobStruct`1/ExecuteJobFunction<UnityEngine.Rendering.InstanceDataSystem/ReallocateInstancesJob>:invoke_void_T&_intptr_intptr_JobRanges&_int (UnityEngine.Rendering.InstanceDataSystem/ReallocateInstancesJob&,intptr,intptr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,int)
0x000002A1F97A2ED6 (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void__this___intptr&_intptr_intptr_intptr&_int (object,intptr,intptr,intptr)
0x00007FFF17F2697E (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\mini\mini-runtime.c:3445] mono_jit_runtime_invoke
0x00007FFF17E68444 (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\object.c:3068] do_runtime_invoke
0x00007FFF17E68530 (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\object.c:3115] mono_runtime_invoke
0x00007FFED467A224 (Unity) scripting_method_invoke
0x00007FFED46520F3 (Unity) ScriptingInvocation::Invoke
0x00007FFED427B244 (Unity) ExecuteJob
0x00007FFED427C1BD (Unity) ForwardJobToManaged
0x00007FFED427D3B6 (Unity) ScheduleManagedJob
0x00007FFED38B3B3D (Unity) JobsUtility_CUSTOM_Schedule
0x000002A0F6B5329D (Mono JIT Code) (wrapper managed-to-native) Unity.Jobs.LowLevel.Unsafe.JobsUtility:Schedule_Injected (Unity.Jobs.LowLevel.Unsafe.JobsUtility/JobScheduleParameters&,Unity.Jobs.JobHandle&)
0x000002A0F6B531CB (Mono JIT Code) Unity.Jobs.LowLevel.Unsafe.JobsUtility:Schedule (Unity.Jobs.LowLevel.Unsafe.JobsUtility/JobScheduleParameters&)
0x000002A1FA13FF4B (Mono JIT Code) Unity.Jobs.IJobExtensions:Run<UnityEngine.Rendering.InstanceDataSystem/ReallocateInstancesJob> (UnityEngine.Rendering.InstanceDataSystem/ReallocateInstancesJob)
0x000002A20414FDE3 (Mono JIT Code) [.\Library\PackageCache\com.unity.render-pipelines.core\Runtime\GPUDriven\InstanceData\InstanceDataSystem.cs:484] UnityEngine.Rendering.InstanceDataSystem:ReallocateAndGetInstances (UnityEngine.Rendering.GPUDrivenRendererGroupData&,Unity.Collections.NativeArray`1<UnityEngine.Rendering.InstanceHandle>)
0x000002A20414DF93 (Mono JIT Code) [.\Library\PackageCache\com.unity.render-pipelines.core\Runtime\GPUDriven\RenderersBatchersContext.cs:232] UnityEngine.Rendering.RenderersBatchersContext:ReallocateAndGetInstances (UnityEngine.Rendering.GPUDrivenRendererGroupData&,Unity.Collections.NativeArray`1<UnityEngine.Rendering.InstanceHandle>)
0x000002A20414D223 (Mono JIT Code) [.\Library\PackageCache\com.unity.render-pipelines.core\Runtime\GPUDriven\GPUResidentBatcher.cs:163] UnityEngine.Rendering.GPUResidentBatcher:UpdateRendererData (UnityEngine.Rendering.GPUDrivenRendererGroupData&,System.Collections.Generic.IList`1<UnityEngine.Mesh>,System.Collections.Generic.IList`1<UnityEngine.Material>)
0x000002A20414A1D1 (Mono JIT Code) UnityEngine.Rendering.GPUDrivenProcessor/<>c:<.cctor>b__34_0 (UnityEngine.Rendering.GPUDrivenRendererGroupDataNative&,System.Collections.Generic.List`1<UnityEngine.Mesh>,System.Collections.Generic.List`1<UnityEngine.Material>,UnityEngine.Rendering.GPUDrivenRendererDataCallback)
0x000002A204147D67 (Mono JIT Code) UnityEngine.Rendering.GPUDrivenCallbacks:InvokeGPUDrivenRendererDataNativeCallback (UnityEngine.Rendering.GPUDrivenRendererDataNativeCallback,UnityEngine.Rendering.GPUDrivenRendererGroupDataNative&,System.Collections.Generic.List`1<UnityEngine.Mesh>,System.Collections.Generic.List`1<UnityEngine.Material>,UnityEngine.Rendering.GPUDrivenRendererDataCallback)
0x000002A204147E2D (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void_object_intptr&_object_object_object (object,intptr,intptr,intptr)
0x00007FFF17F2697E (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\mini\mini-runtime.c:3445] mono_jit_runtime_invoke
0x00007FFF17E68444 (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\object.c:3068] do_runtime_invoke
0x00007FFF17E68530 (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\object.c:3115] mono_runtime_invoke
0x00007FFED467A224 (Unity) scripting_method_invoke
0x00007FFED46520F3 (Unity) ScriptingInvocation::Invoke
0x00007FFED464D3B5 (Unity) ScriptingInvocation::Invoke<void>
0x00007FFED47EAD11 (Unity) Scripting::UnityEngine::Rendering::GPUDrivenCallbacksProxy::InvokeGPUDrivenRendererDataNativeCallback
0x00007FFED3F3E3FE (Unity) GPUDrivenProcessor::EnableGPUDrivenRenderingAndDispatchRendererData
0x00007FFED3821616 (Unity) GPUDrivenProcessor_CUSTOM_EnableGPUDrivenRenderingAndDispatchRendererData
0x000002A204147C95 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Rendering.GPUDrivenProcessor:EnableGPUDrivenRenderingAndDispatchRendererData_Injected (intptr,UnityEngine.Bindings.ManagedSpanWrapper&,UnityEngine.Rendering.GPUDrivenRendererDataNativeCallback,System.Collections.Generic.List`1<UnityEngine.Mesh>,System.Collections.Generic.List`1<UnityEngine.Material>,UnityEngine.Rendering.GPUDrivenRendererDataCallback)
0x000002A204147B0B (Mono JIT Code) UnityEngine.Rendering.GPUDrivenProcessor:EnableGPUDrivenRenderingAndDispatchRendererData (System.ReadOnlySpan`1<int>,UnityEngine.Rendering.GPUDrivenRendererDataNativeCallback,System.Collections.Generic.List`1<UnityEngine.Mesh>,System.Collections.Generic.List`1<UnityEngine.Material>,UnityEngine.Rendering.GPUDrivenRendererDataCallback)
0x000002A2041479EB (Mono JIT Code) UnityEngine.Rendering.GPUDrivenProcessor:EnableGPUDrivenRenderingAndDispatchRendererData (System.ReadOnlySpan`1<int>,UnityEngine.Rendering.GPUDrivenRendererDataCallback)
0x000002A1F97A660B (Mono JIT Code) [.\Library\PackageCache\com.unity.render-pipelines.core\Runtime\GPUDriven\GPUResidentBatcher.cs:123] UnityEngine.Rendering.GPUResidentBatcher:UpdateRenderers (Unity.Collections.NativeArray`1<int>)
0x000002A1F97A519B (Mono JIT Code) [.\Library\PackageCache\com.unity.render-pipelines.core\Runtime\GPUDriven\GPUResidentDrawer.cs:654] UnityEngine.Rendering.GPUResidentDrawer:ProcessRenderers (UnityEngine.TypeDispatchData,Unity.Collections.NativeArray`1<int>)
0x000002A1F979A2C3 (Mono JIT Code) [.\Library\PackageCache\com.unity.render-pipelines.core\Runtime\GPUDriven\GPUResidentDrawer.cs:595] UnityEngine.Rendering.GPUResidentDrawer:PostPostLateUpdate ()
0x000002A1F979957B (Mono JIT Code) [.\Library\PackageCache\com.unity.render-pipelines.core\Runtime\GPUDriven\GPUResidentDrawer.cs:467] UnityEngine.Rendering.GPUResidentDrawer:PostPostLateUpdateStatic ()
0x000002A0482C4CE8 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007FFF17F2697E (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\mini\mini-runtime.c:3445] mono_jit_runtime_invoke
0x00007FFF17E68444 (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\object.c:3068] do_runtime_invoke
0x00007FFF17E68530 (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\object.c:3115] mono_runtime_invoke
0x00007FFED467A224 (Unity) scripting_method_invoke
0x00007FFED46520F3 (Unity) ScriptingInvocation::Invoke
0x00007FFED42C7E96 (Unity) ExecutePlayerLoop
0x00007FFED42C7EB7 (Unity) ExecutePlayerLoop
0x00007FFED42CCFEF (Unity) PlayerLoop
0x00007FFED53CDC4A (Unity) EditorPlayerLoop::Execute
0x00007FFED53E4AE7 (Unity) PlayerLoopController::InternalUpdateScene
0x00007FFED53E689D (Unity) PlayerLoopController::UpdateSceneIfNeededFromMainLoop
0x00007FFED53E06A1 (Unity) Application::TickTimer
0x00007FFED59D4A2A (Unity) MainMessageLoop
0x00007FFED59DA702 (Unity) UnityMain
0x00007FF71D942FBA (Unity) __scrt_common_main_seh
0x00007FFF929C259D (KERNEL32) BaseThreadInitThunk
0x00007FFF9422AF38 (ntdll) RtlUserThreadStart
========== END OF STACKTRACE ===========