void meminfo(void){ …… {"Cached", &kb_page_cache}, // important {"MemFree", &kb_main_free}, // important {"MemTotal", &kb_main_total}, // important {"SReclaimable", &kb_slab_reclaimable}, // "slab reclaimable" (dentry and inode structures) {"Slab", &kb_slab}, // kB version of vmstat nr_slab }; …… kb_main_cached = kb_page_cache + kb_slab_reclaimable; // 区别在这里 kb_swap_used = kb_swap_total - kb_swap_free; mem_used = kb_main_total - kb_main_free - kb_main_cached - kb_main_buffers; if (mem_used < 0) mem_used = kb_main_total - kb_main_free; kb_main_used = (unsigned long)mem_used;