Menu Home

iOS:Get Memory Information

 

- (void)refreshMemoryInfo {
    uint64_t physicalMemorySize;
    uint64_t userMemorySize;
    
    int mib[2];
    size_t length;
    mib[0] = CTL_HW;
    
    mib[1] = HW_MEMSIZE;
    length = sizeof(int64_t);
    sysctl(mib, 2, &physicalMemorySize, &length, NULL, 0);
    
    mib[1] = HW_USERMEM;
    length = sizeof(int64_t);
    sysctl(mib, 2, &userMemorySize, &length, NULL, 0);
}

Categories: iOS

Tagged as:

lnmcc