27 int64_t *likely_free) {
33 size_t length =
sizeof(memsize);
34 if (sysctlbyname(
"hw.memsize", &memsize, &length, NULL, 0) == 0) {
35 *total = (int64_t)memsize;
37 const mach_port_t host = mach_host_self();
38 vm_size_t page_size = 0;
39 vm_statistics64_data_t vm;
40 mach_msg_type_number_t count = HOST_VM_INFO64_COUNT;
41 if (host_page_size(host, &page_size) == KERN_SUCCESS &&
42 host_statistics64(host, HOST_VM_INFO64, (host_info64_t)&vm, &count) ==
44 *free_bytes = (int64_t)vm.free_count * (int64_t)page_size;
46 (int64_t)(vm.free_count + vm.inactive_count + vm.purgeable_count) *
49 mach_port_deallocate(mach_task_self(), host);
void m_memory_details_c(int64_t *total, int64_t *free_bytes, int64_t *likely_free)
Physical memory where /proc/meminfo does not exist (macOS), in bytes: the total, the free pages,...