I used the code in Watching memory usage in iOS to get free memoty for years. But something went wrong since iOS 11 was born. The host_statistics64 will be blocked for 0 to 3 seconds if it is called from two threads simultaneously.
- It won't be blocking before iOS 11 and still not fixed in iOS 11.0.2.
- It won't be blocking under iOS 11 only when it is called from one thread only.
It is might a new bug introduced since iOS 11. But what I am focusing is how to get round of it since many clients have updated to it already.
According to http://newosxbook.com/articles/MemoryPressure.html, we can use sysctl/vm.vm_page_free_targe to get the free memory size under OS/X except for iOS.
Any idea?