


Because of this, the memory allocated on the managed heap is referred to as GC Allocation. The managed heap: A section of memory that the VM automatically controls with a garbage collector (GC).These VMs offer a controlled memory environment divided into the following different types: Mono and IL2CPP’s scripting virtual machines (VMs) implement the managed memory system, which is sometimes referred to as the scripting memory system. In most situations, this memory is inaccessible to Unity users, but it’s useful to be aware of it if you want to fine-tune certain aspects of the performance of your application. Native memory: C++ memory that Unity uses to run the engine.This memory type is called “unmanaged” because it doesn’t use a garbage collector to manage unused parts of memory. C# unmanaged memory: A layer of memory management that you can use in conjunction with the Unity Collections namespace and package.Managed memory: A controlled memory layer that uses a managed heap and a garbage collector to automatically allocate and assign memory.Unity uses three memory management layers to handle memory in your application: This section of the documentation explains how memory works in Unity, and is intended for readers who want to understand how they can improve the memory performance of their application. To ensure your application runs with no performance issues, it’s important to understand how Unity uses and allocates memory.
