Profiling (移动设备性能分析)官方文档笔记

本文档详细介绍了Unity中的内存管理,包括Mono内存和Unity内存的使用,垃圾回收机制,以及如何避免内存碎片和溢出。特别强调了在移动设备上避免OnGUI()函数的频繁使用,提倡预分配内存池和有效管理游戏对象的生命周期来优化内存性能。
摘要由CSDN通过智能技术生成

本文档主要是对Unity官方教程的个人理解与总结(其实以翻译记录为主:>)
仅作为个人学习使用,不得作为商业用途,欢迎转载,并请注明出处。
文章中涉及到的操作都是基于 Unity2017.3版本
参考链接: https://docs.unity3d.com/Manual/MobileProfiling.html

Profiling

First steps
(未完待续)

Memory

内存

There are two types of memory, Mono memory and Unity memory.
有两种类型的内存:Mono 内存和Unity内存。

Mono memory

Mono 内存

Mono memory handles script objects, wrappers for Unity objects (game objects, assets, components, etc). Garbage Collector cleans up when the allocation does not fit in the available memory or on a System.GC.Collect() call.
Mono内存处理脚本对象,作为Unity对象的封装(游戏的对象、资产、组件等)。当可用内存分配不适合或 System.GC.Collect() 调用时,垃圾收集器就会清理。

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.
内存是在堆块中分配的。如果无法将数据放入已分配的块中,则可以申请分配更多块。堆块将保持在Mono中,直到应用程序关闭。换句话说,Mono并没有释放任何内存到操作系统中(Unity 3.x)。一旦你分配了一定数量的内存,它就会被保留为mono,而不可用于操作系统再分配。即使你释放了它&

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值