I’ve been working on my unity project, and this happened:
So, my project has some Recursive functions, since it is about making a chess engine(rule-based AI). And when I test it out, I find my memory going higher and higher every time my engine finishes a search. Well, I thought it was a problem with my code, thinking I missed something. I added the Memory Profiler package and found huge “Untracked” memory usage. I could not figure out where my code was wrong, so I decided to break it down, deleting some parts and trying again. Then I found something. Memory usage does not go down after I stopped the application. Also, when the Memory Profiler window is opened, it takes quite a lot of memory; Again, after I closed the window, memory usage never went down.
This is the memory usage after I closed the Memory Profiler window. It might not seem that much. However, when I leave my engine searching for about 1 minute, it goes up to around 1GB.
This is not normal at all. One thing I’m sure of is that the memory does not go down(Unity Editor is not releasing memory I guess) even if I stop the application and wait for minutes. And I’m pretty sure it is not a problem with my code, since I tried running simple programs, and it still didn’t release the memory.
I found this question:
Unity Editor Memory Leak
I could not get the answer.