feat: add fileBacked
and purgeable
fields to process.getSystemMemoryInfo()
for macOS (#48146)
feat: add fileBacked and purgeable fields to process.getSystemMemoryInfo() for macOS
This commit is contained in:
parent
9eede35fc1
commit
441cff700b
2 changed files with 8 additions and 1 deletions
|
@ -211,6 +211,10 @@ Returns `Object`:
|
||||||
system.
|
system.
|
||||||
* `free` Integer - The total amount of memory not being used by applications or disk
|
* `free` Integer - The total amount of memory not being used by applications or disk
|
||||||
cache.
|
cache.
|
||||||
|
* `fileBacked` Integer _macOS_ - The amount of memory that currently has been paged out to storage.
|
||||||
|
Includes memory for file caches, network buffers, and other system services.
|
||||||
|
* `purgeable` Integer _macOS_ - The amount of memory that is marked as "purgeable". The system can reclaim it
|
||||||
|
if memory pressure increases.
|
||||||
* `swapTotal` Integer _Windows_ _Linux_ - The total amount of swap memory in Kilobytes available to the
|
* `swapTotal` Integer _Windows_ _Linux_ - The total amount of swap memory in Kilobytes available to the
|
||||||
system.
|
system.
|
||||||
* `swapFree` Integer _Windows_ _Linux_ - The free amount of swap memory in Kilobytes available to the
|
* `swapFree` Integer _Windows_ _Linux_ - The free amount of swap memory in Kilobytes available to the
|
||||||
|
|
|
@ -183,8 +183,11 @@ v8::Local<v8::Value> ElectronBindings::GetSystemMemoryInfo(
|
||||||
#endif
|
#endif
|
||||||
dict.Set("free", free);
|
dict.Set("free", free);
|
||||||
|
|
||||||
|
#if BUILDFLAG(IS_MAC)
|
||||||
|
dict.Set("fileBacked", mem_info.file_backed);
|
||||||
|
dict.Set("purgeable", mem_info.purgeable);
|
||||||
|
#else
|
||||||
// NB: These return bogus values on macOS
|
// NB: These return bogus values on macOS
|
||||||
#if !BUILDFLAG(IS_MAC)
|
|
||||||
dict.Set("swapTotal", mem_info.swap_total);
|
dict.Set("swapTotal", mem_info.swap_total);
|
||||||
dict.Set("swapFree", mem_info.swap_free);
|
dict.Set("swapFree", mem_info.swap_free);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue