getMemoryInfo
getMemoryInfo
Info
getMemoryInfo is a synchronous query function that returns physical memory slot information. It spawns the C# helper EXE which queries Win32_PhysicalMemory via WMI, returning an array of MemorySlotInfo objects.
Signature
function getMemoryInfo(): MemorySlotInfo[];Return Value
| Type | Description |
|---|---|
MemorySlotInfo[] | Array of memory slot information (one per installed RAM stick) |
Warning
Empty DIMM slots are not reported. A system with 4 slots and 2 sticks returns an array of length 2.
Usage
Use this function to display installed RAM details, check memory configuration, or verify that all slots are populated.
Note
This returns physical memory module data, not runtime memory usage. For current memory utilization, use getMemory() from the Performance Monitor plugin.
Tips
Sum capacityBytes across all entries to calculate total installed RAM.
Example
import { getMemoryInfo } from '@eisland/windows-hardware-info-helper';
const slots = getMemoryInfo();
let totalGB = 0;
for (const slot of slots) {
const gb = (slot.capacityBytes ?? 0) / 1073741824;
totalGB += gb;
console.log(`${slot.deviceLocator}: ${gb.toFixed(0)} GB ${slot.memoryType ?? ''} @ ${slot.speedMhz ?? '?'} MHz`);
}
console.log(`\nTotal: ${totalGB.toFixed(0)} GB across ${slots.length} module(s)`);const { getMemoryInfo } = require('@eisland/windows-hardware-info-helper');
const slots = getMemoryInfo();
let totalGB = 0;
for (const slot of slots) {
const gb = (slot.capacityBytes ?? 0) / 1073741824;
totalGB += gb;
console.log(`${slot.deviceLocator}: ${gb.toFixed(0)} GB ${slot.memoryType ?? ''} @ ${slot.speedMhz ?? '?'} MHz`);
}
console.log(`\nTotal: ${totalGB.toFixed(0)} GB across ${slots.length} module(s)`);Notes
Note
The memoryType field is mapped from WMI codes to strings: "DDR", "DDR2", "DDR3", "DDR4", "DDR5". Unknown codes fall back to the raw number.
Tips
Use partNumber to look up the exact module specifications from the manufacturer's website.
Important
speedMhz is the rated speed, not the actual running speed. XMP/EXPO profiles may cause the actual speed to differ from the JEDEC specification.
Danger Avoidance
Caution
Do not assume all modules have the same speed or capacity. Mixed configurations are common. Always iterate over all entries rather than reading only the first one.
Changelog
bb5b2-on

