Mac OS X的[内存]:wired, active, inactive和free

转自:http://www.19lou.com/forum-1658-thread-25902363-1-1.html

简单的说,Mac OS X的[内存]使用情况分为:wired, active, inactive和free四种。



  wired是系统核心占用的,永远不会从系统物理[内存]种驱除。


  active表示这些[内存]数据正在使用种,或者刚被使用过。

  inactive表示这些[内存]中的数据是有效的,但是最近没有被使用。

  free, 表示这些[内存]中的数据是无效的,这些空间可以随时被程序使用。

  当free的[内存]低于某个值(这个值是由你的物理[内存]大小决定的),系统则会按照以下顺序使用inactive的资源。首先

如果inactive的数据最近被调用了,系统会把它们的状态改变成active,并接在原有active[内存]逻辑地址的后面, 如果inactive的

[内存]数据最近没有被使用过,但是曾经被更改过而还没有在硬盘的相应虚拟[内存]中做修改,系统会对相应硬盘的虚拟[内

存]做修改,并把这部分物理[内存]释放为free供程序使用。如果inactive[内存]中得数据被在映射到硬盘后再没有被更改过,

则直接释放成free。最后如果active的[内存]一段时间没有被使用,会被暂时改变状态为inactive。
  
所以说,如果你的系统里有少量的free memeory和大量的inactive的memeory,说明你的[内存]是够用的,系统运行在最佳状

态,只要需要,系统就会使用它们,不用担心。而反之如果系统的free memory和inactive memory都很少,而active memory

很多,说明你的[内存]不够了。当然一开机,大部分[内存]都是free,这时系统反而不在最佳状态,因为很多数据都需要从硬盘

调用,速度反而慢了。



转自:http://www.cnblogs.com/tony508/archive/2011/01/28/1946837.html


相信大家做iphone开发都遇到过内存吃紧的问题,最要命的是不知道究竟自己刚写的这段代码用了多少内存(被instrument骗过好多次了),下面贴出我常用的查看现有内存方法

代码
-  ( double )availableMemory {
    vm_statistics_data_t vmStats;
    mach_msg_type_number_t infoCount 
=  HOST_VM_INFO_COUNT;
    kern_return_t kernReturn 
=  host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t) & vmStats,  & infoCount);
    
    
if (kernReturn  !=  KERN_SUCCESS) {
        
return  NSNotFound;
    }
    
// vmStats.wire_count
    
// vmStats.inactive_count
    
// vmStats.active_count
     return  ((vm_page_size  *  vmStats.free_count)  /   1024.0 /   1024.0 ;
}

 

以下是相关内存用语的名词解释 

 

Free memory

This is RAM that's not being used.
 

Wired memory

Information in this memory can't be moved to the hard disk, so it must stay in RAM. The amount of Wired memory depends on the applications you are using.
 

Active memory

This information is currently in memory, and has been recently used.
 

Inactive memory

This information in memory is not actively being used, but was recently used.

For example, if you've been using Mail and then quit it, the RAM that Mail was using is marked as Inactive memory. This Inactive memory is available for use by another application, just like Free memory.  However, if you open Mail before its Inactive memory is used by a different application, Mail will open quicker because its Inactive memory is converted to Active memory, instead of loading Mail from the slower hard disk.
 

Used

This is the total amount of memory used.
 

VM size

This is the total amount of Virtual Memory for all processes on your Mac. 
 

Page ins / Page outs

This refers to the amount of information moved between RAM and the hard disk. This number is a cumulative amount of data that Mac OS X has moved between RAM and disk space.

Tip: Page outs occur when your Mac has to write information from RAM to the hard drive (because RAM is full).  Adding more RAM may reduce page outs.
 

Swap used

This is the amount of information copied to the swap file on your hard drive.


(更多内存使用信息可查阅苹果开发文档:Memory Usage Performance Guidelines )


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Splashtop Wired XDisplay是一款可以将iPad或手机作为电脑的扩展屏幕的软件。它可以通过有线连接将电脑的屏幕扩展到iPad或手机上,提供更大的工作空间。\[2\]关于白嫖Splashtop Wired XDisplay,根据我所了解,Splashtop Wired XDisplay是一款免费的软件,可以在iPad或手机上免费使用。你可以通过在iPad或手机上安装Splashtop Wired XDisplay软件来实现电脑屏幕的扩展。\[3\]你可以从官方网站或其他可信的下载渠道下载Splashtop Wired XDisplay软件进行安装和使用。\[1\]希望这个回答对你有帮助! #### 引用[.reference_title] - *1* *3* [【经验分享】让iPad或者手机作为电脑扩展屏幕使用—Splashtop Wired XDisplay(亲测有效且免费)](https://blog.csdn.net/Sunnyside_/article/details/122202817)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [手机/平板电脑作为pc电脑扩展屏——Splashtop Wired XDisplay使用教程](https://blog.csdn.net/qq_32906123/article/details/130534290)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值