Unity Total System Memory Usage increasing very quickly even after all objects in the scene are disabled

My Unity Standalone Build was crashing after running a few hours with an error saying :

Resource id out of range in GetResource: “1048576”

So I decided to check memory profiler(assuming that the above error is caused due to memory leak) and found out that my Total System Memory Usage is increasing very quickly … So I tried disabling some of the scripts and some objects etc … none of them stopped the increase in memory usage … so I disabled all objects in the scene completely and still, the memory usage was increasing despite all scripts and objects being disabled … So can anyone give me some pointers as to where this leak could be arising …

Any help would appreciated … Thank you

  1. Disabling scripts and gameObjects wont release memory. Script must be designed to do that.

  2. Easiest way of running out of memory is to create engine-managed objects every frame (like Texture2D) and not destroy them, ever.

  3. To find out what allocations are getting out of control - install Memory Profiler package and, take a memory snapshots and analyze those. Alternatively search your codebase for “new” keyword and take a look at life of those objects (are they all becoming de-allocated at some point).