代码:
#include <sys/sysinfo.h>
struct sysinfo s_info;
int error = sysinfo(&s_info);
if(s_info.totalram>1*1024*1024*1024)
{
logv("error0: %d, total: %lu free: %lu \n", error, s_info.totalram, s_info.freeram);
}
输出:
error0: 0, total: 1822605312 free: 1664593920