AssetBundle.LoadFromFile加载一个80MB的assetbundle会分配1MB左右的pss内存
adb分析:private-other
UnityProfiler分析:有3块
1.Other/AssetBundle/LoadingCache
2.Other/SerializedFile/archive:/CAB-e42axxxxxxx
3.NotSaved/AssetBundle/xxxxxx.ab
ab.LoadAllAssets或ab.LoadAsset会从磁盘上加载具体的资源到内存中约110MB
adb分析:根据不同的手机有不同的情况
中兴a2322有两块:1.graphics,2.private-other
OPPO k10有一块 private-other
UnityProfiler分析:为主要为一块即Assets/下面的具体资源,
如果有ParticleSystem,prefab,等其它资源的的话也会有其它的内存如:SceneMemory/ParticleSystem,SceneMemory/GameObject等等
ab.Unload(true)后
adb分析:会根据操作系统决定释放多少内存,或者不释放。
UnityProfiler分析:会释放掉绝大多数的资源,比如他可能并不释放Other/AssetBundle/LoadingCache这一块
中兴a2322测试数据
测试对象为一个80MB的ab ab中只有Texture 手机型号:中兴a2322 | 初始内存 | AssetBundle. LoadFromFile | ab.LoadAllAssets | ab.Unload(true) |
内存变化概要 | pss+2MB private-other+1.5MB | pss+119MB graphics+97MB private-other+21MB Texture+108MB | pss未变化 graphics未变化 private-other未变化 另一台oppo手机这 边的变化就比较正常 Texture-108MB | |
(Android Api) | 228.58MB | 230.94MB | 350.48MB | 351.33MB |
summary.java-heap | 10.09MB | 10.87MB | 11.36MB | 11.7MB |
summary.native-heap | 38.57MB | 38.68MB | 39.59MB | 39.55MB |
summary.code | 76.36MB | 76.31MB | 76.31MB | 76.31MB |
summary.stack | 1.56MB | 1.54MB | 1.54MB | 1.54MB |
summary.graphics | 12.31MB | 12.35MB | 109.09MB | 109.09MB |
summary.private-other | 66.61MB | 68.05MB | 89.44MB | 89.98MB |
summary.system | 23.07MB | 23.15MB | 23.15MB | 23.16MB |
summary.total-pss | 228.58MB | 230.94MB | 350.48MB | 351.33MB |
Mono | 6.94MB/7.11MB | 7.42MB/9.52MB | 7.96MB/9.52MB | 8.45MB/9.52MB |
Object | 41.72MB | 41.87MB | 151.14MB | 41.72MB |
Texture | 38MB | 38MB | 146.62MB | 38MB |
__Texture2D | 570.082kb | 570.082kb | 109.17MB | 570.082kb |
__RenderTexture | 37.16MB | 37.16MB | 37.16MB | 37.16MB |
Mesh | 131.398kb | 131.398kb | 131.398kb | 131.398kb |
AnimationClip | 0kb | 0kb | 0kb | 0kb |
Shader | 784.579kb | 784.579kb | 784.579kb | 784.579kb |
Font | 58.309kb | 58.309kb | 58.309kb | 58.309kb |
Cubemap | 193.555kb | 193.555kb | 193.555kb | 193.555kb |
Transform | 14.008kb | 14.008kb | 14.008kb | 14.008kb |
MonoBehaviour | 597.965kb | 597.965kb | 597.965kb | 597.965kb |
Material | 42.09kb | 42.09kb | 42.09kb | 42.09kb |
MeshRenderer | 0kb | 0kb | 0kb | 0kb |
GameObject | 7.406kb | 7.406kb | 7.406kb | 7.406kb |
Sprite | 2.578kb | 2.578kb | 672.955kb | 2.578kb |
oppo k10测试数据
测试对象为一个80MB的ab ab中只有Texture 手机型号:oppo k10 | 初始内存 | AssetBundle. LoadFromFile | ab.LoadAllAssets | ab.Unload(true) |
内存变化概要 | pss+2MB private-other+1MB java-heap+1MB | pss+105MB private-other+105MB | pss-70MB private-other-68MB 中兴手机这边的变化就比较奇怪 | |
summary.java-heap | 9.86MB | 10.77MB | 11.51MB | 9.85MB |
summary.native-heap | 53.4MB | 53.41MB | 53.35MB | 53.33MB |
summary.code | 83.34MB | 83.34MB | 83.34MB | 83.41MB |
summary.stack | 2MB | 2.02MB | 2.02MB | 1.98MB |
summary.graphics | 93.14MB | 93.15MB | 93.16MB | 93.16MB |
summary.private-other | 67.34MB | 68.32MB | 173.1MB | 105.03MB |
summary.system | 20.05MB | 20.05MB | 20.07MB | 20.07MB |
summary.total-pss | 329.13MB | 331.07MB | 436.55MB | 366.82MB |