用户工具

站点工具


侧边栏

script:unityengine:classes:profiler:profiler.getmonousedsize

Profiler.GetMonoUsedSize 获取Mono使用大小

JavaScript ⇒ public static function GetMonoUsedSize(): uint;
C# ⇒ public static uint GetMonoUsedSize();

Description 描述

Returns the used size from mono.

返回Mono使用的内存的大小。

This is the amount of allocated memory for non collected objects in Mono memory always call GC.Collect before this call, as non referenced objects will still take up space untill they are collected. If not Collecting, this will display an ever growing number untill Collect is called elsewhere.

这是Mono内存中非收集对象的分配内存的数量,调用该函数之前总是先调用GC.Collect,非引用对象依然会占用空间直到他们被采集。如果没有采集,这将会显示一个曾经生成的数字直到Collect 在别处被调用。

JavaScript:

function Update() {
	#if ENABLE_PROFILER
		System.GC.Collect();
		Debug.Log("Mono used size" + Profiler.GetMonoUsedSize() + "Bytes");
	#endif
}

C#:

using UnityEngine;
using System.Collections;
 
public class ExampleClass : MonoBehaviour {
	void Update() {
	        #if ENABLE_PROFILER
        	        System.GC.Collect();
                	Debug.Log("Mono used size" + Profiler.GetMonoUsedSize() + "Bytes");
        	#endif  
	}
}

profiler

script/unityengine/classes/profiler/profiler.getmonousedsize.txt · 最后更改: 2016/08/02 05:37 (外部编辑)