Skip to content
Permalink
Browse files
Fix free page calculations on iOS
Summary:
[iOS] [Fixed] - Fix how the amount of free memory is calculated to mimic the logic Apple uses.

For example, see https://opensource.apple.com/source/system_cmds/system_cmds-805.250.2/vm_stat.tproj/vm_stat.c.auto.html for how `vm_stat` does it:

```
sspstat("Pages free:", (uint64_t) (vm_stat.free_count - vm_stat.speculative_count));
```

Reviewed By: shergin

Differential Revision: D17671714

fbshipit-source-id: 18ef31e17a0527a9bef7a408922cd687260866db
  • Loading branch information
Gunnar Kudrjavets authored and facebook-github-bot committed Oct 1, 2019
1 parent 769d518 commit b53d3d80f991937915a87ba8515f403551de139e
Showing 1 changed file with 1 addition and 1 deletion.
@@ -31,7 +31,7 @@ static NSUInteger RCTDeviceFreeMemory() {
if (kern != KERN_SUCCESS) return 0;
kern = host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size);
if (kern != KERN_SUCCESS) return 0;
return vm_stat.free_count * page_size;
return (vm_stat.free_count - vm_stat.speculative_count) * page_size;
}

@interface RCTUIImageViewAnimated () <CALayerDelegate>

0 comments on commit b53d3d8

Please sign in to comment.