Unity20213.9f Have been experiencing memory leak since using unity 2021. I just tried using the memory profiler and noticed that within 4 minutes, memory allocated grew 10GB (editor). I am not even doing anything in the scene, and the scene doesn't even do anything other then the fact that it does a webquest, show some buttons, and thats it. Comparing the snapshots, I was able to see that these allocations all came from Managed Array System.Byte[]. There are hundreds (maybe even 1000+) of these System.Byte[] ranging from 0-100827136 in lengths. Now.. How can I see where these byte[] are coming from? None of the existing code creates byte[], more importantly, it shouldn't have a length of 100827136.. #Update I tried checking memory on Android, I don't see the same System.Byte[], however, there is still memory leak as the same scene will eventually crash without interaction.. I am unable to find out where the leak is coming from.
Yes i am. The leak is also random. Sometimes it happens within 5 minutes, sometimes it doesn't happen in hours. I can't pinpoint where it is coming from except for the suspicion that this is a unity thing.
What is referencing these byte []? And are you opening any memory snapshots while this increase is happening? Because the memory Profiler UI currently loads the entire managed heap as managed byte [] into memory, so if you are taking a snapshot while a snapshot is open, you're exponentially growing your managed heap usage.
Yes, I had the snapshot opened. I realized byte[] wasn't causing the memory leak and crashing, it is something else. But I am unable to pinpoint what is causing it with profiler or memry profiler. Before upgrading to 2021, I've seen console message stating there was memory leak with a collection or something like that in 2020. the message no longer appeared in 2021 but there are random screen freeze crashing (but sound is working).