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

顾琛
2023-12-01
#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;

}
 类似资料: