Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Bug TLS Allocator ALLOC_TEMP_TLS problem when selecting my terrain

Discussion in 'Editor & General Support' started by wohoyefe, Nov 14, 2021.

  1. wohoyefe

    wohoyefe

    Joined:
    Apr 25, 2020
    Posts:
    16
    Hi everyone. I've found a few threads in regards to this error message, but none related to selecting a terrain, and none of the suggestions I found resolved the issue. In both, Unity 2021.1.28 and 2021.2.2 I'm getting the error listed below as soon as I click on a terrain in my editor. I can reproduce it nearly every time by opening unity, opening a scene, going into play mode, exiting play mode and then clicking on a terrain either in the scene editor or in the hierarchy.

    The editor usually gets really slow when the error appears, so every time I want to edit my terrain, or I click on it by accident, I would have to restart Unity, which takes quite some time. The only way how I've gotten rid of the error in scenes where it happens, was by exporting the terrain's height map, deleting the terrain, creating a whole new terrain and then importing the height map on there. But I want to avoid this because I'd have to redo all the textures and more.

    Error:
    TLS Allocator ALLOC_TEMP_TLS, underlying allocator ALLOC_TEMP_MAIN has unfreed allocations, size 248976

    Thank you so much
     
    Last edited: Jan 27, 2022
    masakimasa likes this.
  2. masakimasa

    masakimasa

    Joined:
    Oct 19, 2020
    Posts:
    4
    I'm also having this issue on Unity 2021.2.2f and some older versions.
    I'm using Terrain Tool version 4.0.3.

    The console is filled 999+ with the following message:
    Allocation of 56 bytes at 0x144080310

    Currently, restarting Unity seems to be the only way to fix it.
     
    wohoyefe likes this.
  3. stevphie123

    stevphie123

    Joined:
    Mar 24, 2021
    Posts:
    70
    Same here.. anybody has any temporary solution to this?
     
    wohoyefe likes this.
  4. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    301
  5. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    316
    Definitely not fixed - this bug is coming up in various situations right now, quite frustrating.

    // Wildstyle
     
  6. hopelesscate

    hopelesscate

    Joined:
    Mar 1, 2017
    Posts:
    2
    Same on Unity 2021.2.8f - 2021.2.10f on our work project. Can't figure out what may cause this but as described above it mostly happen when you're working with terrain. Probably issue in terrain tools.
     
    unity_NWxPn0_AAtZcWw likes this.
  7. ItsJustaGroove

    ItsJustaGroove

    Joined:
    Nov 6, 2021
    Posts:
    4
    Hello,

    I can confirm this for 2021.2.10f. I get this even with super simple projects when I use terrain and a few simple prefabs. This happens in 2021.2.4+x version even with default URP Templates and 2 or 3 extra prefabs in the scene when I toggle between play and edit mode without any own C# script involved.

    Fingers crossed to get it fixed.

    All the Best
     
  8. Avant132

    Avant132

    Joined:
    May 9, 2013
    Posts:
    1
    I was having this error on my project in 2021.2.7. Very annoying and made it impossible to debug my project since the error flooded my console. Restarting would temporarily get rid of the issue, but it would happen again after re-opening and exiting play mode every time. I tried re-importing all of my assets, but that would also only solve the issue until the next time I exited play mode. Once the error started, the only way to debug my project was to restart unity, re-open the project, and then I got one shot at debugging before having to restart again.

    However, after upgrading my project from 2021.2.7 to 2021.2.10 I no longer get the issue. It looks like this isn't the case for everyone on this thread, but something about the upgrade process solved it for me thankfully.
     
  9. StopLookAndGo

    StopLookAndGo

    Joined:
    May 11, 2018
    Posts:
    17
    I'm having the same error on 2020.3.24f1 LTS, it mostly shows up when using the scene view and it can rack up an error count in the thousands since it ticks up quite fast.
     
  10. wohoyefe

    wohoyefe

    Joined:
    Apr 25, 2020
    Posts:
    16
    I've found another thread where people brought up this issue and some of the comments are indeed about the terrain. The two most interesting comments I found were

    - this seems to happen especially after adding a fifth layer to the terrain
    - when you uncheck "Selection outline" in the Gizmos at the top of the editor window, then this error does not appear

    I was able to reproduce both of these statements. I've not heard about whether or not this problem will be resolved in any specific version and also I really don't like upgrading my projects. So for now, I just disable the selection outline and carry on like this.

    Here's the threat:
    "Allocation of 32 bytes at 0000027D70016A00" error on Unity Editor | Page 2 - Unity Forum
     
  11. rodrigozol

    rodrigozol

    Joined:
    Apr 4, 2009
    Posts:
    29
    My Terrain has five layers, just uncheck "Selection outline" solve the problem!
     
  12. PAU_L

    PAU_L

    Joined:
    Feb 19, 2021
    Posts:
    11
    This problem may be related to some infinite loop that's entered into via recursion as I've found in a particular piece of code that lacks proper ending conditions.
     
    glatteinfo likes this.
  13. Drake4

    Drake4

    Joined:
    Jun 17, 2022
    Posts:
    22
    Using 2021.3.91f and got the Error in this format in Playmode and in Editor Mode:

    TLS Allocator ALLOC_TEMP_TLS, underlying allocator ALLOC_TEMP_MAIN has unfreed allocations, size 5854

    Closing and reopening of the unity project solves this issue for me as well.

    The problem occured for me, through some code, which was trapped in an infinite loop, causing a stack overflow. If that code got executed once during playmode the above issue continued to exist in edit mode even after play mode was exited.
     
    Last edited: Mar 4, 2023
  14. DrunkenMastah

    DrunkenMastah

    Joined:
    Sep 26, 2017
    Posts:
    51
    2022.2.12f1

    Endlessly spamming: TLS Allocator ALLOC_TEMP_TLS, underlying allocator ALLOC_TEMP_MAIN has unfreed allocations

    Appeared randomly and now I cannot close Unity.
     
  15. nnikolamilovanovic

    nnikolamilovanovic

    Joined:
    Jan 31, 2023
    Posts:
    1
    Same problem here, using 2022.2.5f1
     
    x1alphaz1 likes this.
  16. x1alphaz1

    x1alphaz1

    Joined:
    Dec 19, 2020
    Posts:
    21
    happened to me in unity 2022.2.12
    i went to Window->Layout->Reset All and restart Unity Editor
    issue gone for now
     
    unity_HqARthY1Cog95Q likes this.
  17. x1alphaz1

    x1alphaz1

    Joined:
    Dec 19, 2020
    Posts:
    21
    New happened to me in unity 2022.2.12
    i went to Window->Layout->Reset All and restart Unity Editor
    issue gone for now
     
    Walter_Hulsebos likes this.
  18. GregoryFenn

    GregoryFenn

    Joined:
    Feb 13, 2018
    Posts:
    43
    I have detailed memory leak validation enabled and my error is as follows - it applies both to Editor and Play runtime. Does anyone have any clues what is happening? The memory profiler doesn't help at all, it just tells me which frames periodically have a massice spike in GC allocation but no clues about what objects are causing the GC to go wild:


    Allocation of 16 bytes at 0000015040734640
    0x00007ff738f59390 (Unity) dynamic_array_detail::dynamic_array_data::grow
    0x00007ff738c52c6c (Unity) dynamic_array<std::pair<EditorExtension * __ptr64,EditorExtension * __ptr64>,0>::push_back
    0x00007ff738da5350 (Unity) CollectAllComponentsWithoutAdding
    0x00007ff738da225c (Unity) AddComponent
    0x00007ff73903ebf6 (Unity) MonoAddComponentWithType
    0x00007ff738245c27 (Unity) GameObject_CUSTOM_Internal_AddComponentWithType
    0x00000151ea2e0154 ((<unknown>))
    0x00000151e97bfed3 ((<unknown>))
    0x00000151fc89ad4b (Mono JIT Code) UnityEngine.UIElements.BaseField`1<single>:set_value (single)
    0x000001532dc691e3 ((<unknown>))
    0x000001532dc68e7b ((<unknown>))
    0x000001532dc0e738 ((<unknown>))
    0x00007fffa0650394 (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445)
    0x00007fffa058eb44 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3066)
    0x00007fffa058ecdc (mono-2.0-bdwgc) mono_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3113)
    0x00007ff739141a24 (Unity) scripting_method_invoke
    0x00007ff739122344 (Unity) ScriptingInvocation::Invoke
    0x00007ff73912242e (Unity) ScriptingInvocation::InvokeChecked
    0x00007ff7391b3036 (Unity) SerializableManagedRef::CallMethod
     
  19. glatteinfo

    glatteinfo

    Joined:
    Nov 17, 2019
    Posts:
    18
    The error was in my case created by a script with an infinite loop. Once I hit the play button, the errors started appearing - even if I disabled the script and hit play again. What fixed it was me killing the infinite loop and then restarting unity.
     
    SciCodeStudio likes this.