getSystemMemoryInMegabytes method
Implementation
@visibleForTesting
int getSystemMemoryInMegabytes() {
final memoryInKilobytes = calloc<ULONGLONG>();
try {
final result = GetPhysicallyInstalledSystemMemory(memoryInKilobytes);
if (result != 0) {
return memoryInKilobytes.value ~/ 1024;
} else {
developer.log('Failed to get system memory', error: GetLastError());
return 0;
}
} finally {
free(memoryInKilobytes);
}
}