TLS Allocator ALLOC_TEMP_TLS and Calling Deallocate on pointer, that can not be deallocated by allocator

Hello, I’m running Unity 6.0.26 LTS, I upgraded the project from 2022 LTS, HDRP.

I didnt get the following errors until later after I migrated. I keep getting spammed with this error:

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

and this warning:

Calling Deallocate on pointer, that can not be deallocated by allocator ALLOC_TEMP_MAIN

To Debug, run app with -diag-temp-memory-leak-validation cmd line argument. This will output the callstacks of the leaked allocations.

I don’t know what happened to have caused this. I’ve been looking around at solutions from others and I’ve tried Reimporting All, Rebuilding Library, Creating a new HDRP asset.

Ive also been trying to figure out how to find the source of the issue with the -diag-temp-memory-leak-validation cmd line argument but I don’t know how to set that up. Tried following a tutorial on this but no such luck…

I can still play and build without it crashing but these errors are constant. Any tips would be greatly appreciated.

1 Like

Can anyone lend a hand with this error? Still getting spammed with:

TLS Allocator ALLOC_TEMP_TLS, underlying allocator ALLOC_TEMP_MAIN has unfreed allocations

I’ve seen dozens of people report similar issues, there seems to be a bug with Unity.Collections, Burst.

I have not seen anyone from Unity respond.

Can I ask if you are using DX12?

My Project is filled with these errors, mine leads to crashing in editor, game and while building, although I edited a Memory.cs file which has at least stop the crashing, although probably isn’t a good workaround.

1 Like

Thanks for the reply. My GPU and Windows is running DX12 yes.

I only have 1 error and about 10 warnings at a time on this, a bit more fortunate than you it sounds like :frowning:

I’m not sure if it’s a script or unity and i dont know how to profile that debug command.

Yes it seems to be only a DX12 issue.

In The Unity Hub on your project if you right click, an option for “Add Command Line Arguments”

Just paste the line:

-diag-job-temp-memory-leak-validation

into that, and when you reload the project, it should give you more verbose details of the memory leak.

Ah interesting…thanks! That worked but still only said ‘Calling Deallocate on pointer, that can not be deallocated by allocator ALLOC_TEMP_MAIN’ in the console.

hi! Such an error still occurs in Unity 6.1
In my case, I figured out that using MaterialVariant can cause spamming of this error.
Usually, I get it after saving a scene or clicking on some random objects.
I make a search by type “Material” and do “flatten material variant” to all MaterialVariants in my project, and have no errors!

I was gradually deleting all objects from the scene (regulary resarting Unity to clear memory) till 1 object was left, and it was using a MaterialVariant, so I get rid of it and after another Unity restart, I had no error, then changed material to MaterialVariant and it start erroring again.