17 struct mach_task_basic_info info;
18 mach_msg_type_number_t count = MACH_TASK_BASIC_INFO_COUNT;
20 if(task_info(mach_task_self(), MACH_TASK_BASIC_INFO, (task_info_t)&info,
21 &count) != KERN_SUCCESS)
25 bytes = info.resident_size;
28 long long int llmem = 0;
29 long long int rss = 0;
32 std::ifstream ifs(
"/proc/self/stat", std::ios_base::in);
33 ifs >> ignore >> ignore >> ignore >> ignore >> ignore >> ignore >> ignore >> ignore >> ignore >> ignore
34 >> ignore >> ignore >> ignore >> ignore >> ignore >> ignore >> ignore >> ignore >> ignore >> ignore
35 >> ignore >> ignore >> llmem >> rss;
37 long long int page_size_bytes = sysconf(_SC_PAGE_SIZE);
38 mem = rss*page_size_bytes;
static double GetMemoryUsageInMB()
Get current memory usage in Megabytes.
static CSTMemory GetMemoryUsage()
Get current memory usage.