@@ -7,6 +7,7 @@ import process from 'process'
7
7
import { filesize } from 'filesize'
8
8
9
9
import { getGpuInfo } from './gpu'
10
+ import { getMemoryInfo } from './memory'
10
11
import { getOsInfo } from './osInfo'
11
12
import { isSteamDeck } from './steamDeck'
12
13
import { getHeroicVersion } from './heroicVersion'
@@ -70,16 +71,7 @@ async function getSystemInfo(cache = true): Promise<SystemInformation> {
70
71
if ( cache && cachedSystemInfo ) return cachedSystemInfo
71
72
72
73
const cpus = os . cpus ( )
73
- const memory = process . getSystemMemoryInfo ( )
74
- // NOTE: Electron's memory statistics seem to be in kibibytes, not in
75
- // kilobytes (like the docs say)
76
- const totalMemory = memory . total * 1024
77
- // FIXME: This is inaccurate, since "free" RAM is not the same as "available"
78
- // RAM on Linux ("free" often only being a couple hundred MB, while
79
- // "available" can be tens of GBs)
80
- // We're probably going to have to write our own function for this that
81
- // interprets the output of the `free` command
82
- const usedMemory = ( memory . total - memory . free ) * 1024
74
+ const memory = await getMemoryInfo ( )
83
75
const gpus = await getGpuInfo ( )
84
76
const detailedOsInfo = await getOsInfo ( )
85
77
const isDeck = isSteamDeck ( cpus , gpus )
@@ -97,10 +89,10 @@ async function getSystemInfo(cache = true): Promise<SystemInformation> {
97
89
cores : cpus . length
98
90
} ,
99
91
memory : {
100
- total : totalMemory ,
101
- used : usedMemory ,
102
- totalFormatted : filesize ( totalMemory , { base : 2 } ) as string ,
103
- usedFormatted : filesize ( usedMemory , { base : 2 } ) as string
92
+ total : memory . total ,
93
+ used : memory . used ,
94
+ totalFormatted : filesize ( memory . total , { base : 2 } ) as string ,
95
+ usedFormatted : filesize ( memory . used , { base : 2 } ) as string
104
96
} ,
105
97
GPUs : gpus ,
106
98
OS : {
0 commit comments