There are two issues we are concerned about when it comes to memory management: how much we're consuming, and how often we're allocating new blocks. Let's cover each of these topics separately.
We do not have direct control over what is going on in the Native Domain since we don't have the Unity Engine source code and hence can't add any code that will interact with it directly. We can, however, control it indirectly by means of various script-level functions that serve as interaction points between Managed and Native Code. There are technically a variety of memory allocators available, which are used internally for things such as GameObjects
, Graphics objects, and the Profiler, but these are hidden behind the Native-Managed Bridge.
However, we can observe how much memory has been allocated and reserved in this Memory Domain via the Memory Area
of the Profiler
window. Native memory allocations show up under the values labeled Unity
, and we can even...