Memory space within the Unity engine can be essentially split into three different memory domains. Each domain stores different types of data and takes care of a very different set of tasks. Let's take a look at each of them:
- The first memory domain—the managed domain—should be very familiar. This domain is where the Mono platform does its work, where any MonoBehaviour scripts and custom C# classes we write will be instantiated at runtime, and so we will interact with this domain very explicitly through any C# code we write. It is called the managed domain because this memory space is automatically managed by a Garbage Collector (GC).
- The second domain—the native domain—is more subtle since we only interact with it indirectly. ...