unity开发内存优化

  1. ManagedHeap 表示的是Mono所使用的托管堆内存,C#上任何的申请托管的内存都会在这里申请。
  2. ManagedHeap.UsedSize 表示这个托管堆上已经使用的内存大小
  3. ManagedHeap.reservedUnUsedSize 表示托管堆上未使用的内存大小

关于Mono 内存的官方描述:(只增不减)
Memory is allocated in heap blocks. More can allocated if it cannot fit the data into the allocated block. Heap blocks will be kept in Mono until the app is closed. In other words, Mono does not release any memory used to the OS (Unity 3.x). Once you allocate a certain amount of memory, it is reserved for mono and not available for the OS. Even when you release it, it will become available internally for Mono only and not for the OS. The heap memory value in the Profiler will only increase, never decrease.

推荐阅读更多精彩内容