Search Issue Tracker

Won't Fix



Found in






Issue ID




Freeze/crash on MemoryProfilerStats::UnregisterObject when DownloadHandlerTexture is used and Texture2D is already destroyed



Reproduction steps:
1. Open the attached project “ReproProject”
2. Open the “SampleScene” Scene
3. Enter the Play mode
4. Wait a few minutes

Expected result: Editor executes the script attached to the Scene
Actual result: Editor freezes/crashes

Reproducible with: 2020.3.42f1, 2021.3.14f1, 2022.1.24f1, 2022.2.1f1, 2023.1.0a21

Reproducible on: macOS Ventura 13.0.1 (M1), Windows 10

First lines of stack trace:
0x00007ff78b2c208d (Unity) delete_object_internal_step1
0x00007ff78b2be6f0 (Unity) DestroySingleObject
0x00007ff78b5df52d (Unity) DestroyObjectHighLevel_Internal
0x00007ff78b5df0c4 (Unity) DestroyObjectHighLevel
0x00007ff78b59aa8a (Unity) BackgroundJobQueue::ExecuteMainThreadJobs

#0 0x0000010106aa38 in MemoryProfilerStats::UnregisterObject(Object*)
#1 0x0000010106a42c in profiler_unregister_object(Object*)
#2 0x00000100ccd598 in delete_object_internal_step1(Object*)
#3 0x00000100ccc8ac in DestroySingleObject(Object*)
#4 0x00000100ff832c in DestroyObjectHighLevel(Object*, bool)
#5 0x00000100fb7524 in BackgroundJobQueue::ExecuteMainThreadJobs()

  1. Resolution Note:

    Dear customer,

    We've been working diligently to address the issue you recently encountered.
    In our pursuit of ensuring the best possible experience for you, we have released recent Unity versions that includes targeted bug fixes and enhancements.

    If you are still encountering this issue, please open a new bug through Unity Bug Reporting page and our team will gladly look at it again.

    Frank Luong
    Software Development Developer in Test

Comments (7)

  1. Basamas

    Jan 30, 2023 10:42

    2021.3.17 appears to have fixed this error for us. -,looking at the release notes, this may have fixed this issue:

    'Networking: Fixed race condition between DownloadHandlerTexture and Resources.UnloadUnusedAssets, sometimes cause premature destruction of the texture. (UUM-18044)'

  2. ajkoel

    Jan 19, 2023 15:37

    I trust that Unity will do the right thing, and fix this anoiing bug....

  3. Basamas

    Jan 18, 2023 09:08

    For our project this issue started happening when upgrading from 2021.3.9 to 2021.3.10.
    Looking at the release notes, this 'fix' might have broke something:

    Networking: Fixed a texture leak when UnityWebRequest is used with DownloadHandlerTexture and a texture is never queried. (UUM-953)

  4. marcelo_bebopbee

    Jan 12, 2023 14:54

    We are also affected by this issue, that happens on iOS and Android builds. Commenting the line where the downloaded texture is destroyed fixes the crash, but it will leave the texture in memory, so it's not really a workaround :(

  5. zubrinovich

    Jan 12, 2023 07:31

    Have the same issue.

  6. pavloprokopov

    Dec 21, 2022 09:06

  7. code-kiwi

    Dec 10, 2022 09:25

    This crash also happens on Android. I hope it can be fixed soon. We refactored our codebase to reduce the chance of hitting this crash, but it can still happen after a Texture2D is destroyed.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.