41 lines
995 B
C#
41 lines
995 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
|
|
namespace Thousandto.Core.Base
|
|
{
|
|
#if UNITY_IPHONE && !UNITY_EDITOR
|
|
/// <summary>
|
|
/// IOS系统的内存信息获取类
|
|
/// </summary>
|
|
public class IPhoneMemoryInfo:IMemoryInfo
|
|
{
|
|
[DllImport("__Internal")]
|
|
private static extern long MemoryStat_GetFreeMemoryMByte();
|
|
|
|
[DllImport("__Internal")]
|
|
private static extern double MemoryStat_GetAppUsedMemoryMByte();
|
|
|
|
[DllImport("__Internal")]
|
|
private static extern double MemoryStat_GetRAMByte(); // 手机最大RAM
|
|
|
|
|
|
public long GetFreeMemory()
|
|
{
|
|
return MemoryStat_GetFreeMemoryMByte();
|
|
}
|
|
|
|
public double GetSumMemory()
|
|
{
|
|
return MemoryStat_GetRAMByte();
|
|
}
|
|
|
|
public double GetAppUsedMemory()
|
|
{
|
|
return MemoryStat_GetAppUsedMemoryMByte();
|
|
}
|
|
}
|
|
#endif
|
|
}
|