add inactive_memory in Mac UMA

This commit is contained in:
Lizonghang 2024-12-04 11:56:09 +04:00
parent 99d48157a0
commit 585864b05a

View file

@ -419,8 +419,7 @@ static uint64_t device_host_physical_memory(bool available) {
size_t page_size = sysconf(_SC_PAGESIZE); size_t page_size = sysconf(_SC_PAGESIZE);
if (is_uma_arch()) { // Mac UMA with ARM64 if (is_uma_arch()) { // Mac UMA with ARM64
// memory = (vm_stats.free_count + vm_stats.inactive_count) * page_size; memory = (vm_stats.free_count + vm_stats.inactive_count) * page_size;
memory = vm_stats.free_count * page_size; // use "sudo purge" before launching
} else { // Mac with x86_64 } else { // Mac with x86_64
memory = total_memory - (vm_stats.internal_page_count - vm_stats.purgeable_count) * page_size; memory = total_memory - (vm_stats.internal_page_count - vm_stats.purgeable_count) * page_size;
} }