Memory for Mac OS X: wired, active, inactive, and free

Source: Internet
Author: User

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

Mac memory usage: Wired, active, inactive, and free



Wired (linkage ):The core of the system will never be evicted from the system [Memory.


Active ):Indicates that the memory data is in use or has just been used.
Inactive ):Indicates that the data in the memory is valid, but has not been used recently.


Free (available space ):Indicates that the data in the memory is invalid, that is, the memory surplus!


When the free [Memory] is lower than a key value

This key value is determined by the size of your physical memory, and the system will use inactive resources in the following order.


◇ First, if inactive data is recently called, the system will change their status to active and be behind the original active memory logical address;


◇ Secondly, if inactive memory data has not been used recently, but has been changed, but has not been modified in the corresponding virtual [Memory] of the hard disk, the system modifies the virtual memory of the corresponding hard disk and releases the physical memory as free for the program.


◇ Once again, if the data in inactive [Memory] is not changed after it is mapped to the hard disk, it will be released as free.

◇ If the active memory is not used for a period of time, it will be changed to inactive temporarily.


Therefore, if your system has a small amount of free memeory and a large number of inactive memeory, it indicates that your memory is sufficient and the system runs in the optimal state, as long as needed, the system will use them, so don't worry.

If the free memory and inactive memory of the system are few, but there are many active memory, your [Memory] is not enough. Of course, most of the [Memory] on the server is free, and the system is not in the optimal state, because a lot of data needs to be called from the hard disk, but the speed is slow.



Bytes --------------------------------------------------------------------------------------------------------

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

I believe that everyone has encountered a memory shortage problem during iPhone development. The most terrible thing is that they don't know how much memory they have used for the code they just wrote (I 've been cheated by instrument many times ), the following shows my frequently used methods for viewing existing memory.


#import <sys/sysctl.h>
#import <mach/mach.h>

- (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;
}
Official glossary

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.

(For more memory usage information, refer to Apple's Development Documentation: memory usage performance guidelines)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.