Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

(Metal) Editor Crashes on MemoryManager::Deallocate

Discussion in 'Editor & General Support' started by GainfulSage, Feb 4, 2020.

  1. GainfulSage

    GainfulSage

    Joined:
    Apr 30, 2015
    Posts:
    60
    Hi!

    I'm getting a *lot* of crashes with Unity on 2019.3.0f6. My project is about 6GB, so not small, not big (at least IMHO).

    The crashes blow up the Unity editor. The macOS crash reporter is showing this stack trace in particular (the interesting parts in bold):

    Thread 27 Crashed:: BatchDeleteObjects
    0 libsystem_kernel.dylib 0x00007fff71faa7fa __pthread_kill + 10
    1 libsystem_pthread.dylib 0x00007fff72067bc1 pthread_kill + 432
    2 libsystem_c.dylib 0x00007fff71f31a1c abort + 120
    3 com.unity3d.UnityEditor5.x 0x00000001036cda1e HandleSignal(int, __siginfo*, void*) + 62
    4 libmonobdwgc-2.0.dylib 0x000000014cb3a269 mono_chain_signal + 79
    5 libmonobdwgc-2.0.dylib 0x000000014cb3a5ac sigabrt_signal_handler + 86
    6 libsystem_platform.dylib 0x00007fff7205c42d _sigtramp + 29
    7 ??? 000000000000000000 0 + 0
    8 libsystem_c.dylib 0x00007fff71f31a1c abort + 120
    9 libsystem_malloc.dylib 0x00007fff72027647 malloc_vreport + 548
    10 libsystem_malloc.dylib 0x00007fff7202a40e malloc_report + 151
    11 com.unity3d.UnityEditor5.x 0x000000010265a4c3 MemoryManager::Deallocate(void*, char const*, int) + 467
    12 com.unity3d.UnityEditor5.x 0x000000010265aa67 MemoryManager::Deallocate(void*, MemLabelId const&, char const*, int) + 1143
    13 com.unity3d.UnityEditor5.x 0x00000001001f430c dynamic_array<unsigned char, 0ul>::~dynamic_array() + 44
    14 com.unity3d.UnityEditor5.x 0x0000000102c82202 Texture2D::DestroyTexture() + 66
    15 com.unity3d.UnityEditor5.x 0x0000000102c8c799 Texture2D::~Texture2D() + 25

    16 com.unity3d.UnityEditor5.x 0x00000001026eb1bf delete_object_internal_step2(Object*) + 31
    17 com.unity3d.UnityEditor5.x 0x000000010307586e BatchDeleteStep2Threaded(void*) + 238
    18 com.unity3d.UnityEditor5.x 0x0000000103558e1c Thread::RunThreadWrapper(void*) + 1228
    19 libsystem_pthread.dylib 0x00007fff72067e65 _pthread_start + 148
    20 libsystem_pthread.dylib 0x00007fff7206383b thread_start + 15

    I do have thousands of textures in my project. My preliminary investigation hasn't found any that are unusually large or corrupt.

    I have tried deleting the temp files and reimporting assets, which takes quite a while and so far hasn't done anything. Running macOS 10.15.3, plenty of RAM, disk. Not seeing crashes in any other software. Ran the BIOS hardware checker, reported everything is fine.

    Is anyone else seeing these crashes? Any suggestions...? Unity crashing all the time is... not fun.
     
  2. GainfulSage

    GainfulSage

    Joined:
    Apr 30, 2015
    Posts:
    60
    Here is another crash that occurred when I tried to quit, looks like a similar root cause:

    Thread 0 Crashed:: Main Thread Dispatch queue: com.apple.main-thread
    0 libsystem_kernel.dylib 0x00007fff71d1a7fa __pthread_kill + 10
    1 libsystem_pthread.dylib 0x00007fff71dd7bc1 pthread_kill + 432
    2 libsystem_c.dylib 0x00007fff71ca1a1c abort + 120
    3 com.unity3d.UnityEditor5.x 0x00000001100ffa1e HandleSignal(int, __siginfo*, void*) + 62
    4 libmonobdwgc-2.0.dylib 0x000000015953a269 mono_chain_signal + 79
    5 libmonobdwgc-2.0.dylib 0x000000015953a5ac sigabrt_signal_handler + 86
    6 libsystem_platform.dylib 0x00007fff71dcc42d _sigtramp + 29
    7 ??? 000000000000000000 0 + 0
    8 libsystem_c.dylib 0x00007fff71ca1a1c abort + 120
    9 libsystem_malloc.dylib 0x00007fff71d97647 malloc_vreport + 548
    10 libsystem_malloc.dylib 0x00007fff71d9a40e malloc_report + 151
    11 com.unity3d.UnityEditor5.x 0x000000010f08c4c3 MemoryManager::Deallocate(void*, char const*, int) + 467
    12 com.unity3d.UnityEditor5.x 0x000000010f08ca67 MemoryManager::Deallocate(void*, MemLabelId const&, char const*, int) + 1143
    13 com.unity3d.UnityEditor5.x 0x000000010cc2630c dynamic_array<unsigned char, 0ul>::~dynamic_array() + 44
    14 com.unity3d.UnityEditor5.x 0x000000010f6b4202 Texture2D::DestroyTexture() + 66
    15 com.unity3d.UnityEditor5.x 0x000000010f6be799 Texture2D::~Texture2D() + 25
    16 com.unity3d.UnityEditor5.x 0x000000010f11acfc delete_object_internal(Object*) + 44
    17 com.unity3d.UnityEditor5.x 0x000000010fa8c3de CleanupAllObjects() + 1646
    18 com.unity3d.UnityEditor5.x 0x000000010fa8cb3a CleanupEngine() + 42
    19 com.unity3d.UnityEditor5.x 0x000000010d8bcc7d Application::CoreShutdown() + 253
    20 com.unity3d.UnityEditor5.x 0x000000010d8c67ba Application::Terminate(bool) + 1002
    21 com.unity3d.UnityEditor5.x 0x000000011122f950 -[EditorApplication applicationShouldTerminate:] + 64
    22 com.apple.AppKit 0x00007fff379d6e17 -[NSApplication _docController:shouldTerminate:] + 88
    23 com.apple.AppKit 0x00007fff379d6cec __91-[NSDocumentController(NSInternal) _closeAllDocumentsWithDelegate:shouldTerminateSelector:]_block_invoke + 448
    24 com.apple.AppKit 0x00007fff379d69a6 -[NSDocumentController(NSInternal) _closeAllDocumentsWithDelegate:shouldTerminateSelector:] + 1187
    25 com.apple.AppKit 0x00007fff379d64dc -[NSDocumentController(NSInternal) __closeAllDocumentsWithDelegate:shouldTerminateSelector:] + 291
    26 com.apple.AppKit 0x00007fff379d6109 -[NSApplication _shouldTerminate] + 963
    27 com.apple.AppKit 0x00007fff379c3542 -[NSApplication terminate:] + 750
    28 com.unity3d.UnityEditor5.x 0x0000000111230be2 -[EditorApplication terminate:] + 114
    29 com.unity3d.UnityEditor5.x 0x000000011122d1ca EditorApplicationForwardingTarget::Execute(MenuItem const&) + 170
    30 com.unity3d.UnityEditor5.x 0x000000010d5a136a MenuController::ExecuteMenuItem(MenuItem&, MenuController::ExecutionCause) + 122
    31 com.unity3d.UnityEditor5.x 0x000000010ed8dea3 EditorApplication_CUSTOM_ExecuteMenuItem(ScriptingBackendNativeStringPtrOpaque*) + 275
     
  3. GainfulSage

    GainfulSage

    Joined:
    Apr 30, 2015
    Posts:
    60
    ...and another:

    Thread 39 Crashed:: UnityGfxDeviceWorker
    0 libsystem_kernel.dylib 0x00007fff6f5287fa __pthread_kill + 10
    1 libsystem_pthread.dylib 0x00007fff6f5e5bc1 pthread_kill + 432
    2 libsystem_c.dylib 0x00007fff6f4afa1c abort + 120
    3 com.unity3d.UnityEditor5.x 0x000000010364da1e HandleSignal(int, __siginfo*, void*) + 62
    4 libmonobdwgc-2.0.dylib 0x0000000144d3a269 mono_chain_signal + 79
    5 libmonobdwgc-2.0.dylib 0x0000000144d3a5ac sigabrt_signal_handler + 86
    6 libsystem_platform.dylib 0x00007fff6f5da42d _sigtramp + 29
    7 ??? 000000000000000000 0 + 0
    8 libsystem_c.dylib 0x00007fff6f4afa1c abort + 120
    9 libsystem_malloc.dylib 0x00007fff6f5a5647 malloc_vreport + 548
    10 libsystem_malloc.dylib 0x00007fff6f5a840e malloc_report + 151
    11 com.unity3d.UnityEditor5.x 0x00000001025da4c3 MemoryManager::Deallocate(void*, char const*, int) + 467
    12 com.unity3d.UnityEditor5.x 0x00000001025daa67 MemoryManager::Deallocate(void*, MemLabelId const&, char const*, int) + 1143
    13 com.unity3d.UnityEditor5.x 0x00000001025da7eb MemoryManager::Deallocate(void*, MemLabelId const&, char const*, int) + 507
    14 com.unity3d.UnityEditor5.x 0x00000001025da7eb MemoryManager::Deallocate(void*, MemLabelId const&, char const*, int) + 507

    15 com.unity3d.UnityEditor5.x 0x000000010251fde1 GfxDeviceWorker::ReadBufferDataComplete(ThreadedStreamBuffer&) + 353
    16 com.unity3d.UnityEditor5.x 0x000000010251a81a GfxDeviceWorker::RunCommand(ThreadedStreamBuffer&) + 49210
    17 com.unity3d.UnityEditor5.x 0x00000001045677bc GfxDeviceWorkerAutoreleasePoolProxy + 60
    18 com.unity3d.UnityEditor5.x 0x000000010251ef30 GfxDeviceWorker::RunExt(ThreadedStreamBuffer&) + 640
    19 com.unity3d.UnityEditor5.x 0x000000010250e238 GfxDeviceWorker::RunGfxDeviceWorker(void*) + 152
    20 com.unity3d.UnityEditor5.x 0x00000001034d8e1c Thread::RunThreadWrapper(void*) + 1228
    21 libsystem_pthread.dylib 0x00007fff6f5e5e65 _pthread_start + 148
    22 libsystem_pthread.dylib 0x00007fff6f5e183b thread_start + 15
     
  4. GainfulSage

    GainfulSage

    Joined:
    Apr 30, 2015
    Posts:
    60
    All of these seem to be related to Unity internal memory management. Can't think of anything I can do to fix... :(
     
  5. GainfulSage

    GainfulSage

    Joined:
    Apr 30, 2015
    Posts:
    60
    And when deleting all the temp files and rebuilding the project...

    Thread 0 Crashed:: tid_307 Dispatch queue: com.apple.main-thread
    0 libsystem_kernel.dylib 0x00007fff6b8f27fa __pthread_kill + 10
    1 libsystem_pthread.dylib 0x00007fff6b9afbc1 pthread_kill + 432
    2 libsystem_c.dylib 0x00007fff6b879a1c abort + 120
    3 com.unity3d.UnityEditor5.x 0x000000010e585a1e HandleSignal(int, __siginfo*, void*) + 62
    4 libmonobdwgc-2.0.dylib 0x00000001470ba269 mono_chain_signal + 79
    5 libmonobdwgc-2.0.dylib 0x00000001470ba5ac sigabrt_signal_handler + 86
    6 libsystem_platform.dylib 0x00007fff6b9a442d _sigtramp + 29
    7 ??? 000000000000000000 0 + 0
    8 libsystem_c.dylib 0x00007fff6b879a1c abort + 120
    9 libsystem_malloc.dylib 0x00007fff6b96f647 malloc_vreport + 548
    10 libsystem_malloc.dylib 0x00007fff6b97240e malloc_report + 151
    11 com.unity3d.UnityEditor5.x 0x000000010d5124c3 MemoryManager::Deallocate(void*, char const*, int) + 467
    12 com.unity3d.UnityEditor5.x 0x000000010d512a67 MemoryManager::Deallocate(void*, MemLabelId const&, char const*, int) + 1143
    13 com.unity3d.UnityEditor5.x 0x000000010b0ac30c dynamic_array<unsigned char, 0ul>::~dynamic_array() + 44
    14 com.unity3d.UnityEditor5.x 0x000000010db3a202 Texture2D::DestroyTexture() + 66
    15 com.unity3d.UnityEditor5.x 0x000000010db44799 Texture2D::~Texture2D() + 25

    16 com.unity3d.UnityEditor5.x 0x000000010d5a0b88 UnloadObject(Object*) + 56
    17 com.unity3d.UnityEditor5.x 0x000000010cbf9a68 UnloadImportedAssetsNotPresentInSnapshot(LoadedImportedAssetsSnapshot const&) + 728
    18 com.unity3d.UnityEditor5.x 0x000000010ccb6550 AssetImportManager::Import(core::hash_map<AssetDatabase::ImporterID, ImporterInfo, core::hash<AssetDatabase::ImporterID>, std::__1::equal_to<AssetDatabase::ImporterID> > const&, dynamic_array<PostprocessorInfo, 0ul> const&, AssetResolver&, CategorizedAssets&, IImportProgress*, core::hash_set<UnityGUID, core::hash<UnityGUID>, std::__1::equal_to<UnityGUID> > const&, LoadedImportedAssetsSnapshot const*, core::hash_set<core::basic_string<char, core::StringStorageDefault<char> >, core::hash<core::basic_string<char, core::StringStorageDefault<char> > >, std::__1::equal_to<core::basic_string<char, core::StringStorageDefault<char> > > >&, CrashedAssetImportsDatabase&, core::hash_set<ArtifactKey, core::hash<ArtifactKey>, std::__1::equal_to<ArtifactKey> >&) + 2592
    19 com.unity3d.UnityEditor5.x 0x000000010cc39873 RefreshInternalV2(AssetDatabase::UpdateAssetOptions, ScanFilter const&, InternalRefreshFlagsV2) + 9619
    20 com.unity3d.UnityEditor5.x 0x000000010cc2e60a StopAssetImportingV2(AssetDatabase::UpdateAssetOptions, InternalRefreshFlagsV2, ScanFilter const*) + 314
    21 com.unity3d.UnityEditor5.x 0x000000010cc2ea3f RefreshV2(AssetDatabase::UpdateAssetOptions) + 143
    22 com.unity3d.UnityEditor5.x 0x000000010cb121ea AssetDatabase::Refresh(AssetDatabase::UpdateAssetOptions) + 298
    23 com.unity3d.UnityEditor5.x 0x000000010bd36100 Application::InitializeProject() + 20688
    24 com.unity3d.UnityEditor5.x 0x000000010f6b619d -[EditorApplication applicationDidFinishLaunching:] + 221
    25 com.apple.CoreFoundation 0x00007fff340fd35f __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
    26 com.apple.CoreFoundation 0x00007fff340fd2f3 ___CFXRegistrationPost1_block_invoke + 63
    27 com.apple.CoreFoundation 0x00007fff340fd268 _CFXRegistrationPost1 + 372
    28 com.apple.CoreFoundation 0x00007fff340fcebe ___CFXNotificationPost_block_invoke + 97
    29 com.apple.CoreFoundation 0x00007fff340cc7e2 -[_CFXNotificationRegistrar find:eek:bject:eek:bserver:enumerator:] + 1575
    30 com.apple.CoreFoundation 0x00007fff340cbc82 _CFXNotificationPost + 1351
    31 com.apple.Foundation 0x00007fff36751a22 -[NSNotificationCenter postNotificationName:eek:bject:userInfo:] + 59
    32 com.apple.AppKit 0x00007fff312d4fef -[NSApplication _postDidFinishNotification] + 312
    33 com.apple.AppKit 0x00007fff312d4d32 -[NSApplication _sendFinishLaunchingNotification] + 208
    34 com.apple.AppKit 0x00007fff312d1df3 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 549
    35 com.apple.AppKit 0x00007fff312d1a39 -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 688
    36 com.apple.Foundation 0x00007fff3677d246 -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 308
    37 com.apple.Foundation 0x00007fff3677d0b0 _NSAppleEventManagerGenericHandler + 98
    38 com.apple.AE 0x00007fff35481092 0x7fff35474000 + 53394
    39 com.apple.AE 0x00007fff354807b9 0x7fff35474000 + 51129
    40 com.apple.AE 0x00007fff35478a27 aeProcessAppleEvent + 449
    41 com.apple.HIToolbox 0x00007fff32c6d2b8 AEProcessAppleEvent + 54
    42 com.apple.AppKit 0x00007fff312cbe4c _DPSNextEvent + 1670
    43 com.apple.AppKit 0x00007fff312ca380 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
    44 com.apple.AppKit 0x00007fff312bc09e -[NSApplication run] + 658
    45 com.apple.AppKit 0x00007fff3128e465 NSApplicationMain + 777
    46 com.unity3d.UnityEditor5.x 0x000000010f6f84bf EditorMain(int, char const**) + 1055
    47 com.unity3d.UnityEditor5.x 0x000000010f6f87c9 main + 9
    48 libdyld.dylib 0x00007fff6b7ab7fd start + 1
     
  6. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    7,244
    Try use earlier version of Unity and see, if that makes difference. Other than that, you better use editor report option. Send all crashes. That automatically will send you hardware specs, which you should post it here as well.

    Try make reproducable error if possible with details.

    Other than that, try maybe split scene in multiple scenes, to reduce number of loaded objects.
     
  7. GainfulSage

    GainfulSage

    Joined:
    Apr 30, 2015
    Posts:
    60
    Yeah, I've already reported, including sending my project in. Now I'm just waiting for feedback.

    FWIW, It's an iMac, 4.2GHz i7. 32GB of RAM. Radeon Pro 580 8 GB. Not getting any kind of other memory-related error messages. With Unity and Chrome, etc. Activity Monitor is only showing 11-12GB of memory in use with absolutely no memory pressure.

    The stack traces appear to indicate that it's failing trying to deallocate memory that was never allocated in the first place.

    FWIW the game seems to run fine when exported, and generally runs fine in the editor... until it doesn't, lol.

    RE: earlier version... my understanding was I can only go forward, not backward. I've been on 2019.3.x for a bit now, unfortunately. If I could go back to 2019.2.x I would. :p
     
  8. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    7,244
    Generally there is no much of issue going backward, as long you don't use specific features, which are used by your latest used Unity.
    There are some unofficial instructions, how to go backwards.
    I think someone also posted few months back. Typically to change line, or so, in manifest files, or relevant.
     
  9. GainfulSage

    GainfulSage

    Joined:
    Apr 30, 2015
    Posts:
    60
    Successfully back-ported to 2019.2.20f1. All I had to do was select the older version in Unity Hub. I got a warning message about down-rev but otherwise it happily opened up. Only issues were tweaking the versions of a few things in the Package Manager and having to redo/add/tweak a few Assembly Definitions.

    I'll be curious to see how long it takes for the 2019.3 bug to get resolved. I'll post here when I hear back.
     
    Antypodish likes this.
  10. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    7,244
    @GainfulSage is project / Unity stable now for you?
     
    GainfulSage likes this.
  11. GainfulSage

    GainfulSage

    Joined:
    Apr 30, 2015
    Posts:
    60
    So far, yes. After a few hours in the Editor, generating a few builds, no crashes.
     
  12. GainfulSage

    GainfulSage

    Joined:
    Apr 30, 2015
    Posts:
    60
    Unity was able to successfully repro. Here's the public tracker link:

    https://issuetracker.unity3d.com/is...loading-scene-with-a-specific-skybox-material

    The texture that is causing the issue appears to be a skybox material I bought from the Unity Asset store. Per the bug report, Unity was able to repro with a few versions of Unity but not all.

    Really glad that a) Unity got back to me so quickly and b) that I was able to back-rev to 2019.2.x to continue to get work done. No idea what it is about that specific texture that's causing the issue.
     
    Antypodish likes this.
  13. GainfulSage

    GainfulSage

    Joined:
    Apr 30, 2015
    Posts:
    60
    Just updated the thread title to match the bug just on the off chance that someone else runs into this and is searching for the issue.
     
  14. GainfulSage

    GainfulSage

    Joined:
    Apr 30, 2015
    Posts:
    60
    Just got an email from Unity - "Thanks for reporting the issue. We have fixed this problem and it should not appear in Unity 2019.3.3f1 and above."
     
unityunity