Il2cpp crash at malloc

I’m trying to use ILRuntime that uses pointers heavily. Everything works fine in mono but il2cpp crashes overtime at something like: var arr = new float[bignumber]; I’m not sure why or what is the issue exactly. Stack trace and logs in: Il2cpp crashing... · Issue #540 · Ourpalm/ILRuntime · GitHub

Could there be issue that pointers aren’t allocated correctly? If so then why il2cpp crashses and mono doesn’t?

Unity 2020.3.14

Thanks for reporting this issue! We actually discovered it internally last week as well. We have a fix coming to all Unity versions. I’ll reporting back here when the fix is available in 2020.3.

4 Likes

Thanks, fingers crossed for it being included in 2020.3.16 as the bug is currently delaying my game update.

Off-topic: When trying mono instead of il2cpp I’ve noticed that instantiating UI panels was much faster and smoother. I’ll try to make repro project one day, it was something like 20+ panels in scroll rect.

I’m not sure yet about the version, I’ll let you know as soon as I find out.

1 Like

@JoshPeterson we’re seeing a similar issue with frequent calls to saving, which seems like an edge-case (perhaps race condition) where we get a GC_generic_malloc etc issue with EX_BAD_ACCESS on iOS.

2020.3.11f1, 2020.3.13f1

Here is an example stack of the issue we see:

I’m going to guess this is a different issue, as the original problem reported here specifically triggered an assert, where the call stack you provided does not seem to.

Can you submit a bug report with a project that causes this crash?

@JoshPeterson for various reasons, it’s difficult for us to replicate this in a simple project due to the usage of native iOS plugins which would require various XCode configuration on your end in order to run.

However, I do believe these are related to the original post. Consider that the original post concern was around a stack trace consisting of:

     GameAssembly.dll!il2cpp_assert(const char * assertion, const char * file, unsigned int line) Line 12    C++
>    GameAssembly.dll!GC_gcj_vector_proc(unsigned __int64 * addr, GC_ms_entry * mark_stack_ptr, GC_ms_entry * mark_stack_limit, unsigned __int64 env) Line 67    C++
     GameAssembly.dll!GC_mark_from(GC_ms_entry * mark_stack_top, GC_ms_entry * mark_stack, GC_ms_entry * mark_stack_limit) Line 782    C
     GameAssembly.dll!GC_mark_some_inner(char * cold_gc_frame) Line 361    C
     GameAssembly.dll!GC_mark_some(char * cold_gc_frame) Line 506    C
     GameAssembly.dll!GC_stopped_mark(int(*)() stop_func) Line 832    C
     GameAssembly.dll!GC_try_to_collect_inner(int(*)() stop_func) Line 580    C
     GameAssembly.dll!GC_collect_or_expand(unsigned __int64 needed_blocks, int ignore_off_page, int retry) Line 1484    C
     GameAssembly.dll!GC_alloc_large(unsigned __int64 lb, int k, unsigned int flags) Line 64    C
     GameAssembly.dll!GC_generic_malloc(unsigned __int64 lb, int k) Line 264    C
     GameAssembly.dll!GC_malloc_kind_global(unsigned __int64 lb, int k) Line 327    C
     GameAssembly.dll!GC_malloc_kind(unsigned __int64 lb, int k) Line 334    C
     GameAssembly.dll!GC_malloc_atomic(unsigned __int64 lb) Line 342    C
     GameAssembly.dll!il2cpp::vm::Object::AllocatePtrFree(unsigned __int64 size, Il2CppClass * typeInfo) Line 67    C++
     GameAssembly.dll!il2cpp::vm::Array::NewSpecific(Il2CppClass * klass, unsigned __int64 n) Line 128    C++
     GameAssembly.dll!SZArrayNew(Il2CppClass * arrayType, unsigned int length) Line 121    C++

Which is an almost identical crash stack location of ours; consider:

7392599--902732--upload_2021-8-5_11-55-5.png

It’s the shared root of il2cpp::vm::Array::NewSpecific(Il2CppClass*, unsigned long) () seems like a regression in these versions of Unity.

Meanwhile, we’ll continue to try to create a small reproduction project.

Best regards,

@Kamyker The fix should be in 2020.3.16.

You may indeed be correct. When 2020.3.16 is out, can you give that a try? It should correct this issue.

Thank you! Now I only hope it will fix ilruntime crashes.

That’s possible as I was using debug cpp configuration and standalone build.

@JoshPeterson unfortunately 2020.3.16 release has not resolve this issue for us. I’ve created a bug report and will private message you the link.

Essentially, we’re seeing a stack trace that is consistent with an IL2CPP memory allocation issue that seems to be related to BinaryFormatter and subsequent allocations that happen.

Take the following stack trace as an example:

7413341--906665--upload_2021-8-12_14-32-0.png

Same, ill try making repro project.

#Edited

Case 1357810 or Case 1358515 with much smaller repro project

After updating some nuget dlls and removing unneeded ones it stopped crashing but only in Release build (or I wasn’t lucky enough to hit bad memory cell yet). Debug crashes almost instantly.

It’s a bit scary to release an update with that possible crash, ill ask few players to test it.

Thanks both for the information and the bug reports. There may be another issue here than the one we discovered internally - sorry for misleading you. We will investigate these reports.

Thanks for the update, bug reporter worked finally → case 1358515.

I dig through il2cpp output trying to find the cause, here’s the stack trace that later on crashes the project on GC.Collect:

>    GameAssembly.dll!ArrayBuilder_1_ToImmutableAndFree_m8A43B45BFBEA0766547F96B07F3A2EAF5340E0AB_gshared(ArrayBuilder_1_tF965B3BB161639713A1ECA9E0647B21CECFA2798 * __this, const MethodInfo * method) Line 10077    C++
     GameAssembly.dll!ArrayBuilder_1_ToImmutableAndFree_m8A43B45BFBEA0766547F96B07F3A2EAF5340E0AB(ArrayBuilder_1_tF965B3BB161639713A1ECA9E0647B21CECFA2798 * __this, const MethodInfo * method) Line 29200    C++
     GameAssembly.dll!MembersAndInitializersBuilder_ToReadOnlyAndFree_m98071FD4483CE1FA07D02FDF074D798DC8A3E982(MembersAndInitializersBuilder_tEBEDEBF50A9D0A19E1B9DA47E328B4E5BA7BF165 * __this, const MethodInfo * method) Line 32315    C++
     GameAssembly.dll!SourceMemberContainerTypeSymbol_BuildMembersAndInitializers_mA4D602F48CD34C0FBC1B7CA303CCA26A3EE853C5(SourceMemberContainerTypeSymbol_t313BD551412D035E45BF7B0B14FFF7664974CEE9 * __this, DiagnosticBag_t7D7AAB745EABCE30ADF71EA4C8421DDA328A1F45 * ___diagnostics0, const MethodInfo * method) Line 50015    C++
     GameAssembly.dll!SourceMemberContainerTypeSymbol_GetMembersAndInitializers_m8DDC20A7F86D66E413DECF5E79D1B1AB06685531(SourceMemberContainerTypeSymbol_t313BD551412D035E45BF7B0B14FFF7664974CEE9 * __this, const MethodInfo * method) Line 45519    C++
     GameAssembly.dll!SourceMemberContainerTypeSymbol_MakeAllMembers_m29489BFBA38403C2F43D60B6E0263FA16A5C88E2(SourceMemberContainerTypeSymbol_t313BD551412D035E45BF7B0B14FFF7664974CEE9 * __this, DiagnosticBag_t7D7AAB745EABCE30ADF71EA4C8421DDA328A1F45 * ___diagnostics0, const MethodInfo * method) Line 49392    C++
     GameAssembly.dll!SourceMemberContainerTypeSymbol_GetMembersByNameSlow_m62E1F5926BF595BAC4162BEF7FA012F3BF30E9D1(SourceMemberContainerTypeSymbol_t313BD551412D035E45BF7B0B14FFF7664974CEE9 * __this, const MethodInfo * method) Line 45613    C++
     GameAssembly.dll!SourceMemberContainerTypeSymbol_GetMembersByName_m4A43FFB890B7F6A989D885488BDBFCD2C3EEF9CE(SourceMemberContainerTypeSymbol_t313BD551412D035E45BF7B0B14FFF7664974CEE9 * __this, const MethodInfo * method) Line 45572    C++
     GameAssembly.dll!SourceMemberContainerTypeSymbol_ForceComplete_m632E34218B14E9A71A1DFB1B4C7183B8D949A456(SourceMemberContainerTypeSymbol_t313BD551412D035E45BF7B0B14FFF7664974CEE9 * __this, SourceLocation_t957F3E4CA0504C73DA18AA5EAACF2573CC7C4232 * ___locationOpt0, CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD ___cancellationToken1, const MethodInfo * method) Line 42994    C++
     GameAssembly.dll!VirtActionInvoker2<SourceLocation_t957F3E4CA0504C73DA18AA5EAACF2573CC7C4232 *,CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD>::Invoke(unsigned short slot, Il2CppObject * obj, SourceLocation_t957F3E4CA0504C73DA18AA5EAACF2573CC7C4232 * p1, CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD p2) Line 56    C++
     GameAssembly.dll!Symbol_ForceCompleteMemberByLocation_mEC1EDD3D8C57686403F4C49CD3502B9947B3F2CB(SourceLocation_t957F3E4CA0504C73DA18AA5EAACF2573CC7C4232 * ___locationOpt0, Symbol_t2A18793CC4D67272877DCA888FECBC91C98B4F18 * ___member1, CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD ___cancellationToken2, const MethodInfo * method) Line 35137    C++
     GameAssembly.dll!SourceNamespaceSymbol_ForceComplete_mDAA3FE3278B17992048242E31385617B856A1CF1(SourceNamespaceSymbol_tF9318C0E82D3B0292902A2598FB6FFC8B8280B56 * __this, SourceLocation_t957F3E4CA0504C73DA18AA5EAACF2573CC7C4232 * ___locationOpt0, CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD ___cancellationToken1, const MethodInfo * method) Line 43211    C++
     GameAssembly.dll!VirtActionInvoker2<SourceLocation_t957F3E4CA0504C73DA18AA5EAACF2573CC7C4232 *,CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD>::Invoke(unsigned short slot, Il2CppObject * obj, SourceLocation_t957F3E4CA0504C73DA18AA5EAACF2573CC7C4232 * p1, CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD p2) Line 56    C++
     GameAssembly.dll!SourceModuleSymbol_ForceComplete_m44D6EC6B0FEE2E5DB95573A4BF7B3E358EE27966(SourceModuleSymbol_t715B30DA0D77D94F3D533E9679B70E5159039CEB * __this, SourceLocation_t957F3E4CA0504C73DA18AA5EAACF2573CC7C4232 * ___locationOpt0, CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD ___cancellationToken1, const MethodInfo * method) Line 32499    C++
     GameAssembly.dll!VirtActionInvoker2<SourceLocation_t957F3E4CA0504C73DA18AA5EAACF2573CC7C4232 *,CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD>::Invoke(unsigned short slot, Il2CppObject * obj, SourceLocation_t957F3E4CA0504C73DA18AA5EAACF2573CC7C4232 * p1, CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD p2) Line 56    C++
     GameAssembly.dll!SourceAssemblySymbol_ForceComplete_m918F6BE2667526F4553F34AEE3BDCE67C22ECD55(SourceAssemblySymbol_t7FD1FE3518D845F42D877A553A22702BCA4D4AA5 * __this, SourceLocation_t957F3E4CA0504C73DA18AA5EAACF2573CC7C4232 * ___locationOpt0, CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD ___cancellationToken1, const MethodInfo * method) Line 49425    C++
     GameAssembly.dll!VirtActionInvoker2<SourceLocation_t957F3E4CA0504C73DA18AA5EAACF2573CC7C4232 *,CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD>::Invoke(unsigned short slot, Il2CppObject * obj, SourceLocation_t957F3E4CA0504C73DA18AA5EAACF2573CC7C4232 * p1, CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD p2) Line 56    C++
     GameAssembly.dll!CSharpCompilation_GetSourceDeclarationDiagnostics_m88F893CEF32E9AAD00352767299B33C554E7C643(CSharpCompilation_tAF9E622B1BD76CA8394F28E53F36900BC2281706 * __this, SyntaxTree_tCCE97D1A1EDD940F5093E176B8C2AE3688FD384F * ___syntaxTree0, Nullable_1_t152ABB292321E9E09BBB2D5FB029AC6018F19CC5 ___filterSpanWithinTree1, Func_4_t892C0E76E5839586E1D8D8DD306969AA6E4E1451 * ___locationFilterOpt2, CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD ___cancellationToken3, const MethodInfo * method) Line 34727    C++
     GameAssembly.dll!CSharpCompilation_GetDiagnostics_m8B6D6F05728C269F1E71EB0179D3F34E91C93AF9(CSharpCompilation_tAF9E622B1BD76CA8394F28E53F36900BC2281706 * __this, int ___stage0, bool ___includeEarlierStages1, DiagnosticBag_t7D7AAB745EABCE30ADF71EA4C8421DDA328A1F45 * ___diagnostics2, CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD ___cancellationToken3, const MethodInfo * method) Line 34445    C++
     GameAssembly.dll!VirtActionInvoker4<int,bool,DiagnosticBag_t7D7AAB745EABCE30ADF71EA4C8421DDA328A1F45 *,CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD>::Invoke(unsigned short slot, Il2CppObject * obj, int p1, bool p2, DiagnosticBag_t7D7AAB745EABCE30ADF71EA4C8421DDA328A1F45 * p3, CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD p4) Line 67    C++
     GameAssembly.dll!CSharpCompilation_GetDiagnostics_m9D0159B87A1973698BC570C2E749EB371A26E0F5(CSharpCompilation_tAF9E622B1BD76CA8394F28E53F36900BC2281706 * __this, int ___stage0, bool ___includeEarlierStages1, CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD ___cancellationToken2, const MethodInfo * method) Line 34025    C++
     GameAssembly.dll!CSharpCompilation_CompileMethods_mBCD99E431AA4828973DE1F6D4BA2A314A8494B8E(CSharpCompilation_tAF9E622B1BD76CA8394F28E53F36900BC2281706 * __this, CommonPEModuleBuilder_t1943D6E05E10E288AE3043209AFB21F76DF8BAC4 * ___moduleBuilder0, bool ___emittingPdb1, bool ___emitMetadataOnly2, bool ___emitTestCoverageData3, DiagnosticBag_t7D7AAB745EABCE30ADF71EA4C8421DDA328A1F45 * ___diagnostics4, Predicate_1_tF8D01B705BFDDD9F897D4A55B28582F47E5AA6BE * ___filterOpt5, CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD ___cancellationToken6, const MethodInfo * method) Line 35156    C++
     GameAssembly.dll!VirtFuncInvoker7<bool,CommonPEModuleBuilder_t1943D6E05E10E288AE3043209AFB21F76DF8BAC4 *,bool,bool,bool,DiagnosticBag_t7D7AAB745EABCE30ADF71EA4C8421DDA328A1F45 *,Predicate_1_tF8D01B705BFDDD9F897D4A55B28582F47E5AA6BE *,CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD>::Invoke(unsigned short slot, Il2CppObject * obj, CommonPEModuleBuilder_t1943D6E05E10E288AE3043209AFB21F76DF8BAC4 * p1, bool p2, bool p3, bool p4, DiagnosticBag_t7D7AAB745EABCE30ADF71EA4C8421DDA328A1F45 * p5, Predicate_1_tF8D01B705BFDDD9F897D4A55B28582F47E5AA6BE * p6, CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD p7) Line 89    C++
     GameAssembly.dll!Compilation_Emit_mE15B88505AE8F54E6541376F205C6161BE9E58CC(Compilation_tD549E53F1A626524EC1A24C00023176A789E269B * __this, Stream_t5DC87DD578C2C5298D98E7802E92DEABB66E2ECB * ___peStream0, Stream_t5DC87DD578C2C5298D98E7802E92DEABB66E2ECB * ___metadataPEStream1, Stream_t5DC87DD578C2C5298D98E7802E92DEABB66E2ECB * ___pdbStream2, Stream_t5DC87DD578C2C5298D98E7802E92DEABB66E2ECB * ___xmlDocumentationStream3, Stream_t5DC87DD578C2C5298D98E7802E92DEABB66E2ECB * ___win32Resources4, Il2CppObject * ___manifestResources5, EmitOptions_tBF744ECFE28B4FCB31272C70EC5ED5A5568BFBA1 * ___options6, Il2CppObject * ___debugEntryPoint7, Stream_t5DC87DD578C2C5298D98E7802E92DEABB66E2ECB * ___sourceLinkStream8, Il2CppObject * ___embeddedTexts9, CompilationTestData_tC18A2CD93D11D0F130541710BD895D43D41FA06A * ___testData10, CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD ___cancellationToken11, const MethodInfo * method) Line 26967    C++
     GameAssembly.dll!Compilation_Emit_m795B6AA9529080AE428C3C9995D2D9AC18406B51(Compilation_tD549E53F1A626524EC1A24C00023176A789E269B * __this, Stream_t5DC87DD578C2C5298D98E7802E92DEABB66E2ECB * ___peStream0, Stream_t5DC87DD578C2C5298D98E7802E92DEABB66E2ECB * ___pdbStream1, Stream_t5DC87DD578C2C5298D98E7802E92DEABB66E2ECB * ___xmlDocumentationStream2, Stream_t5DC87DD578C2C5298D98E7802E92DEABB66E2ECB * ___win32Resources3, Il2CppObject * ___manifestResources4, EmitOptions_tBF744ECFE28B4FCB31272C70EC5ED5A5568BFBA1 * ___options5, Il2CppObject * ___debugEntryPoint6, Stream_t5DC87DD578C2C5298D98E7802E92DEABB66E2ECB * ___sourceLinkStream7, Il2CppObject * ___embeddedTexts8, Stream_t5DC87DD578C2C5298D98E7802E92DEABB66E2ECB * ___metadataPEStream9, CancellationToken_tC9D68381C9164A4BA10397257E87ADC832AF5FFD ___cancellationToken10, const MethodInfo * method) Line 26830    C++
     GameAssembly.dll!U3CCompileToStreamU3Ed__1_MoveNext_mDB88B245102676A0AAE04272A2DF8E7990D6D1F6(U3CCompileToStreamU3Ed__1_tC2395E9F78C31CFABB5A8842ACBF22108D64E8D4 * __this, const MethodInfo * method) Line 5024    C++
     GameAssembly.dll!U3CCompileToStreamU3Ed__1_MoveNext_mDB88B245102676A0AAE04272A2DF8E7990D6D1F6_AdjustorThunk(Il2CppObject * __this, const MethodInfo * method) Line 5076    C++
     GameAssembly.dll!InterfaceActionInvoker0::Invoke(unsigned short slot, Il2CppClass * declaringInterface, Il2CppObject * obj) Line 165    C++
     GameAssembly.dll!MoveNextRunner_InvokeMoveNext_m6F87A8006A8DD916BAAA543205E987AC6E4E1906(Il2CppObject * ___stateMachine0, const MethodInfo * method) Line 31466    C++
     GameAssembly.dll!ContextCallback_Invoke_mF4F8496213E8F0925947DD8994A477AE2E54EFDF(ContextCallback_t93707E0430F4FF3E15E1FB5A4844BE89C657AE8B * __this, Il2CppObject * ___state0, const MethodInfo * method) Line 41104    C++
     GameAssembly.dll!ExecutionContext_RunInternal_mC5D58D6EDE270B4CDA05181E9064E040D6692B2B(ExecutionContext_t16AC73BB21FEEEAD34A017877AC18DD8BB836414 * ___executionContext0, ContextCallback_t93707E0430F4FF3E15E1FB5A4844BE89C657AE8B * ___callback1, Il2CppObject * ___state2, bool ___preserveSyncCtx3, const MethodInfo * method) Line 19393    C++
     GameAssembly.dll!ExecutionContext_Run_mD1481A474AE16E77BD9AEAF5BD09C2819B60FB29(ExecutionContext_t16AC73BB21FEEEAD34A017877AC18DD8BB836414 * ___executionContext0, ContextCallback_t93707E0430F4FF3E15E1FB5A4844BE89C657AE8B * ___callback1, Il2CppObject * ___state2, bool ___preserveSyncCtx3, const MethodInfo * method) Line 19256    C++
     GameAssembly.dll!MoveNextRunner_Run_mF9986F86D538F629861F62DD912B18CC58980D8B(MoveNextRunner_tFAEA0BEDD353E2E34E8E287C67B1F5572FD30C2D * __this, const MethodInfo * method) Line 31417    C++
     GameAssembly.dll!Action_Invoke_m3FFA5BE3D64F0FF8E1E1CB6F953913FADB5EB89E(Action_tAF41423D285AE0862865348CF6CE51CD085ABBA6 * __this, const MethodInfo * method) Line 21669    C++
     GameAssembly.dll!U3CU3Ec_U3C_cctorU3Eb__7_0_m0B62ED556B3855D4C64C5D7E638D6ED8AB0C4A88(U3CU3Ec_t97DE2C4F7EF16C425D7DB74D03F1E0947B3D9AF2 * __this, Il2CppObject * ___state0, const MethodInfo * method) Line 40837    C++
     GameAssembly.dll!SendOrPostCallback_Invoke_m352534ED0E61440A793944CC44809F666BBC1461(SendOrPostCallback_t6B7334CE017AF595535507519400AC02D688DC3C * __this, Il2CppObject * ___state0, const MethodInfo * method) Line 19778    C++
     GameAssembly.dll!WorkRequest_Invoke_m1C292B7297918C5F2DBE70971895FE8D5C33AA20(WorkRequest_tA19FD4D1269D8EE2EA886AAF036C4F7F09154393 * __this, const MethodInfo * method) Line 38347    C++
     GameAssembly.dll!UnitySynchronizationContext_Exec_mC89E49BFB922E69AAE753887480031A142016F81(UnitySynchronizationContext_t9971A8B24E203428BF2E715ECC6019EE2D77EAD3 * __this, const MethodInfo * method) Line 28926    C++
     GameAssembly.dll!UnitySynchronizationContext_ExecuteTasks_m323E27C0CD442B806D966D024725D9809563E0DD(const MethodInfo * method) Line 29039    C++
     GameAssembly.dll!RuntimeInvoker_FalseVoid_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5(void(*)() methodPointer, const MethodInfo * methodMetadata, void * obj, void * * args) Line 221379    C++
     GameAssembly.dll!il2cpp::vm::Runtime::Invoke(const MethodInfo * method, void * obj, void * * params, Il2CppException * * exc) Line 568    C++
     GameAssembly.dll!il2cpp_runtime_invoke(const MethodInfo * method, void * obj, void * * params, Il2CppException * * exc) Line 1118    C++
     UnityPlayer.dll!scripting_method_invoke(class ScriptingMethodPtr,class ScriptingObjectPtr,struct ScriptingArguments &,class ScriptingExceptionPtr *,bool)    Unknown
     UnityPlayer.dll!ScriptingInvocation::Invoke(class ScriptingExceptionPtr *,bool)    Unknown
     UnityPlayer.dll!ScriptingInvocation::Invoke<void>(class ScriptingExceptionPtr *,bool)    Unknown
     UnityPlayer.dll!Scripting::UnityEngine::UnitySynchronizationContextProxy::ExecuteTasks(class ScriptingExceptionPtr *)    Unknown
     UnityPlayer.dll!`InitPlayerLoopCallbacks'::`2'::UpdateScriptRunDelayedTasksRegistrator::Forward()    Unknown
     UnityPlayer.dll!ExecutePlayerLoop(struct NativePlayerLoopSystem *)    Unknown
     UnityPlayer.dll!ExecutePlayerLoop(struct NativePlayerLoopSystem *)    Unknown
     UnityPlayer.dll!PlayerLoop(void)    Unknown
     UnityPlayer.dll!PerformMainLoop()    Unknown
     UnityPlayer.dll!MainMessageLoop()    Unknown
     UnityPlayer.dll!UnityMainImpl(struct HINSTANCE__ *,struct HINSTANCE__ *,wchar_t *,int)    Unknown
     UnityPlayer.dll!UnityMain()    Unknown
1 Like

For the sake of history, we also see a similar crash stack when deserializing spine animations from an async asset bundle load. It’s not consistent and seems to suggest a race condition that causes memory corruption in the Il2CPP vm runtime. The stack trace is as follows:

GC_mark_from (in UnityFramework) (mark.c:851)
GC_mark_from (in UnityFramework) (mark.c:0)
..
GC_allocobj (in UnityFramework) (alloc.c:1568)
..
il2cpp::vm::String::NewSize(int) (in UnityFramework) (String.cpp:113)
String_CreateString_m16F181739FD8BA877868803DE2CE0EF0A4668D0E (in UnityFramework) (mscorlib15.cpp:0)
JsonDecoder_ParseObject_mA5231DF6CB23559DF5F3E11330C36CDAB40E08F2 (in UnityFramework) (Assembly-CSharp17.cpp:0)
..
JsonDecoder_ParseValue_m6EBE2BA3134A6DD3BEEB3446241DDE9BEB61F270 (in UnityFramework) (Assembly-CSharp17.cpp:0)
..
Json_Deserialize_m73E914E7F7AEBD7F5A4FD0409CB2C5C7143609A9 (in UnityFramework) (Assembly-CSharp17.cpp:0)
SkeletonJson_ReadSkeletonData_mF1FCFD42BEE7B107CC09D3F53BB85955F56B3984 (in UnityFramework) (Assembly-CSharp31.cpp:0)
SkeletonDataAsset_ReadSkeletonData_mAC14964EE82711E95DFCDF7E44C3C3C77A01E0E4 (in UnityFramework) (Assembly-CSharp31.cpp:0)
..
il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2

Hopefully as we gather more information, these stacks can help point toward a solution.

Best regards,

1 Like

Another similar path for crashes, this time it appears when the stack trace is attempting to allocate memory for some exception that occurs:

GC_allocobj (in UnityFramework) (alloc.c:1568)
GC_generic_malloc_inner (in UnityFramework) (malloc.c:192)
..
il2cpp::vm::Object::NewAllocSpecific(Il2CppClass*) (in UnityFramework) (Object.cpp:299)
..
StackTraceUtility_ExtractFormattedStackTrace_m956907F6BE8EFF9BE9847275406FFBBB5FE7F093 (in UnityFramework) (UnityEngine.CoreModule1.cpp:0)
..
il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**) (in UnityFramework) (Runtime.cpp:576)
..
scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool) (in UnityFramework) (ScriptingApi_Il2Cpp.cpp:292)
..
il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**) (in UnityFramework) (Runtime.cpp:576)
..
MonoBehaviour::TryCreateAndRunCoroutine(ScriptingObjectPtr, ScriptingMethodPtr, Coroutine**) (in UnityFramework) (MonoBehaviour.cpp:691)
..
Coroutine::Run(bool*) (in UnityFramework) (Coroutine.cpp:271)
..
RuntimeInvoker_TrueVoid_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5(void (*)(), MethodInfo const*, void*, void**) (in UnityFramework) (Il2CppInvokerTable.cpp:91640)
..
AwakeFromLoadQueue::PersistentManagerAwakeFromLoad() (in UnityFramework) (AwakeFromLoadQueue.cpp:191)
1 Like

@devon_redgames are these stack traces isolated ie nothing was run before them? If not try to run GC.Collect before them to check if memory wasn’t already corrupted.

I have a pretty similar gc_mark_from crash described here:

It looks similar to the one described by Devon.

That link seems to be dead - is there a different link to a forum thread about this?