Total RAM size of an iOS device
ios, iphone, objective-c
Solution
The simplest solution to find total RAM in a device is to use `NSProcessInfo`:
Objective C:
[NSProcessInfo processInfo].physicalMemory
Swift 3:
NSProcessInfo.processInfo().physicalMemory
Swift 5:
ProcessInfo.processInfo.physicalMemory
Note: `physicalMemory` gives us the information at bytes and can be less than the actual devices memory. To calculate GB, divide by `1024³` (1073741824) and round up to the closes integer:
Int(round(Double(physicalMemory) / (1024.0 * 1024.0 * 1024.0)))
As documented here.
Problem
Is it possible to determine actual RAM size of an iOS device? Referring to this question Determining the available amount of RAM on an iOS device we can determine the available free memory but how to get the actual total size.