Hi,
I am using the below code to compute the free memory in iOS.
uint64_t memAvailable() { mach_port_t host_port = mach_host_self(); if(host_port == MACH_PORT_NULL) { return 0; } vm_size_t pagesize; host_page_size(host_port, &pagesize);
vm_statistics_data_t vm_stat;
mach_msg_type_number_t host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t);
if (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS)
{
    tdlog(LOG_LEVEL_DEBUG, @"Failed to fetch vm statistics");
    return 0;
}
/* Stats in bytes */
return vm_stat.free_count * pagesize;
}
My qs is do we need to call mach_port_deallocate() to release the reference count on host_port??
Please advise.