Computer memory is divided into primary and secondary memory. Primary memory, located on the motherboard, is further divided into RAM and ROM. RAM is volatile and loses its contents when power is lost, while ROM is non-volatile and retains its contents even without power. Secondary memory, like hard disks and USB drives, is used to store large amounts of data that cannot fit in primary memory and retains data permanently.