- Home /
how to activate DEBUG_STACK_LEAK
I got this error:
TLS Allocator ALLOC_TEMP_THREAD, underlying allocator ALLOC_TEMP_THREAD has unfreed allocations, size 4080
and the console note said:
To Debug, enable the define: DEBUG_STACK_LEAK in StackAllocator.h. This will output the callstacks of the leaked allocations
I'd like to try that, but I can't find "StackAllocator.h" in any of the project files.
The leak started when I added a scene to the project, and then requested "Generate lighting" in response to messages saying that this was necessary due to a lighting file incompatibility. But post hoc doesn't imply propter hoc, as they say.
Same problem here...
It seems is something related with textures. In my case it started when painting the terrain..
These are bugs internal to engine code or it's dependencies, report them if you know how to reproduce them.
Answer by JackhammerGaming · Jan 21 at 06:16 PM
@j-millen After doing some research it's a kind of memory leak error and there's few ways to get over this
Restart Unity , yup it helps sometimes if it is still there follow below
If you are building the game for ios or android try removing the builds idk why but it fixes the error sometimes
If the script causing the issue has Coroutines in it try commenting them out and see if that's what sucking up so much memory
If nothing works reimport all your assets. (Assets>Reimport All) Clean all the Console Warnings hit play
Thanks for your effort in trying to help me with this. The question was posted some time ago, and now I have a different computer (a Mac $$anonymous$$i M1) and I'm using a 2021 version of Unity. I no longer see "stack leak" messages, but I still get fatal errors when I press the Generate lighting button. They just say that the process ran out of memory.
My solution was to refrain from invoking Generate lighting. Despite the warning, I don't see anything wrong with the rendering; real time lighting with shadows works fine. If I were a professional creating games for sale I would be dissatisfied with this and know, or want to know, what I was missing, but I'm not, so, what the heck.
Your answer
![](https://koobas.hobune.stream/wayback/20220613020643im_/https://answers.unity.com/themes/thub/images/avi.jpg)