zoukankan      html  css  js  c++  java
  • 查询ipad可用内存

    class MemoryTool {
    public:
        static natural_t print_free_memory () {
            mach_port_t host_port;
            mach_msg_type_number_t host_size;
            vm_size_t pagesize;
           
            host_port = mach_host_self();
            host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t);
            host_page_size(host_port, &pagesize);       
           
            vm_statistics_data_t vm_stat;
           
            if (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS)
                NSLog(@"Failed to fetch vm statistics");
           
            /* Stats in bytes */
            natural_t mem_used = (vm_stat.active_count +
                                  vm_stat.inactive_count +
                                  vm_stat.wire_count) * pagesize;
            natural_t mem_free = vm_stat.free_count * pagesize;
            natural_t mem_total = mem_used + mem_free;
            NSLog(@"used: %u free: %u total: %u", mem_used, mem_free, mem_total);
            return mem_free;
        }
    };
  • 相关阅读:
    django中的FBV和CBV
    RESTful
    REST
    18.前端路由router-08权限控制
    17.前端路由router-07keep-alive
    16.前端路由router-06动态路由
    15.前端路由router-05嵌套路由
    14.前端路由router-04编程式导航
    13.前端路由router-03路由参数
    java基础总结
  • 原文地址:https://www.cnblogs.com/chenfulai/p/2139661.html
Copyright © 2011-2022 走看看