If you leave the computer in a completely depowered state for long enough, the main memory (DRAM) can effectively clear by itself without needing to be done manually by the OS.
RAM does not immediately erase itself completely on loss of power. It does so gradually and chaotically, which leads to possibilities of physical side channel attacks to steal secrets from computers (cold boot attack). This is why it’s suggested to shut down a computer and its power supply for a specified amount of time before powering back in, to really ensure the memory is clear.
Your computer is still able to maintain time as it has an auxillary CMOS battery. This lets the BIOS store settings in its own RAM even when powered off, and for the hardware clock to run.
Latest Answers