显示Android当前可用系统内存方法

#include <sys/sysinfo.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <strings.h>

int main(int argc, char ** argv) {

struct sysinfo si;
int rc;

bzero(&si, sizeof(struct sysinfo));
rc = syscall(__NR_sysinfo, &si);

fprintf(stdout, "rc=%d, total RAM reported %ld/n", rc, si.totalram);

return 0;

}

你可能感兴趣的:(android,struct,include)