android程序中查看系统内存使用情况

来个例子

private void displayBriefMemory() {        
          final ActivityManager activityManager = (ActivityManager)   getSystemService(ACTIVITY_SERVICE);    
  
        ActivityManager.MemoryInfo   info = new ActivityManager.MemoryInfo();   
  
          activityManager.getMemoryInfo(info);    
  
          Log.i(tag,"系统剩余内存:"+(info.availMem >> 10)+"k");   
  
          Log.i(tag,"系统是否处于低内存运行:"+info.lowMemory);
  
          Log.i(tag,"当系统剩余内存低于"+info.threshold+"时就看成低内存运行");
  
    }
三个指标:系统剩余内存,系统低内存门限,系统是否低内存运行标志

你可能感兴趣的:(系统内存,meminfo)