15 MEMORYSTATUSEX statex;
16 statex.dwLength =
sizeof (statex);
17 GlobalMemoryStatusEx (&statex);
19 return statex.AvailPageFile;
22 #elif defined(__linux__)
28 unsigned long free_mem = 0;
30 FILE *fd = fopen(
"/proc/meminfo",
"r");
32 fgets(buff,
sizeof(buff), fd);
33 fgets(buff,
sizeof(buff), fd);
34 sscanf(buff,
"%s %lu ", useless, &free_mem);
36 return free_mem * 1000;
39 #elif defined(__unix__)
40 #error "UNIX system other than LINUX aren't supported for now"
41 #elif defined(__MACH__)
42 #error "macos isn't supported for now !"
44 #error "system isn't supported"
QuIDS utility function and variable namespace.
Definition: algorithm.hpp:6
size_t get_free_mem()
function that get the total amount of available free memory.
Definition: memory.hpp:47