Unity3d的内存不足引起崩溃的几种原因

At some points a game may crash with "out of memory" though it in theory it should fit in fine. When this happens compare your normal game memory footprint and the allocated memory size when the crash happens. If the numbers are not similar, then there is a memory spike. This might be due to:

在某些时刻,一个游戏可能由于“内存不足”而崩溃。尽管理论上它最后应当是合适的。当这个问题发生而引发崩溃时,对比你的正规的游戏内存轨迹和已分配内存大小。如果得到的数字不是类似的,那么这就发生了一个内存峰值。这可能是由于:

  • Two big scenes being loaded at the same time - use an empty scene between two bigger ones to fix this. 
    两个大场景被同时加载——为了解决它,在两个更大的场景中间使用一个空的场景。
  • Additive scene loading - remove unused parts to maintain the memory size. 
    附加的场景加载——移除没有用到的部分来维护内存大小。
  • Huge asset bundles loaded to the memory 
    巨大的资源包被加载到内存
  • Loading via WWW or instantiating (a huge amount of) big objects like:
    通过WWW加载或是实例化(大量的实例化)庞大的对象,例如:
    • Textures without proper compression (a no go for mobiles). 
      没有合适压缩的贴图(对于移动设备是无效的)。
    • Textures having Get/Set pixels enabled. This requires an uncompressed copy of the texture in memory. 
      被启用了 获取/设置像素 的贴图。这需要在内存中创建一个贴图的未压缩的复制品。
    • Textures loaded from JPEG/PNGs at runtime are essentially uncompressed. 
      动态地从JPEG/PNGs加载的贴图没有基本上被压缩。
    • Big mp3 files marked as decompress on loading. 
      在加载时,巨大的mp3文件被标记为解压缩。
  • Keeping unused assets in weird caches like static monobehavior fields, which are not cleared when changing scenes. 
    在怪异的缓存中(像静态monobehavior区域,当变换场景时它不会被清理)保留了未使用的资源。
  • 3
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值