Skip to content

Commit

Permalink
Fix free page calculations on iOS
Browse files Browse the repository at this point in the history
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 b53d3d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/Image/RCTUIImageViewAnimated.m
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit b53d3d8

Please sign in to comment.