How do I determine the number of RAM slots in use?

Since you don't mention, I'm assuming this is on Linux.

dmidecode -t memory
dmidecode -t 16
lshw -class memory

Let's make it easy for the not so shell-savvy users:

sudo dmidecode -t memory | grep -i size

The output on my laptop would be:

Size: 2048 MB
Size: 1024 MB

...showing that I have one 1GB module and one 2GB module installed.


In my case,

#dmidecode -t 16

reports this:

Handle 0x000A, DMI type 16, 23 bytes
Physical Memory Array
        Location: System Board Or Motherboard
        Use: System Memory
        Error Correction Type: None
        Maximum Capacity: 16 GB
        Error Information Handle: Not Provided
        Number Of Devices: 2

I would like to point out that I have only 4 GiB of RAM in one module. That info is shown by doing:

 # dmidecode -t 17

this is shown:

# dmidecode 2.11
SMBIOS 2.7 present.

Handle 0x000B, DMI type 17, 34 bytes
Memory Device
    Array Handle: 0x000A
    Error Information Handle: Not Provided
    Total Width: Unknown
    Data Width: Unknown
    Size: No Module Installed
    Form Factor: DIMM
    Set: None
    Locator: ChannelA-DIMM0
    Bank Locator: BANK 0
    Type: Unknown
    Type Detail: None
    Speed: Unknown
    Manufacturer: Not Specified
    Serial Number: Not Specified
    Asset Tag: None
    Part Number: Not Specified
    Rank: Unknown
    Configured Clock Speed: Unknown

Handle 0x000C, DMI type 17, 34 bytes
Memory Device
    Array Handle: 0x000A
    Error Information Handle: Not Provided
    Total Width: 64 bits
    Data Width: 64 bits
    Size: 4096 MB
    Form Factor: SODIMM
    Set: None
    Locator: ChannelB-DIMM0
    Bank Locator: BANK 2
    Type: DDR3
    Type Detail: Synchronous
    Speed: 1600 MHz
    Manufacturer: Hynix/Hyundai
    Serial Number: 11111111
    Asset Tag: None
    Part Number: HMT351S6CFR8C-PB  
    Rank: Unknown
    Configured Clock Speed: 1600 MHz

And, as you can see, Bank 2 is full and Bank 0 empty. Board has only two slots for RAM, but they have to be double channel.