In the old days, BIOSes used to (indirectly) guard against this sort of attack. Way back when, BIOSes used to do a Power On Self Test (POST) that tested various parts of the system (processor, RAM, etc). The test patterns written to RAM would effectively scrub it.
As the years went by, people wanted faster boot times, so the amount of "testing" during POST has been trimmed down. These days, a pretty severely broken system can still boot past POST. Any kind of serious memory testing has been omitted from the default startup sequence. Most BIOSes still have a menu option to enable some memory testing (Quick Boot, Extended Memory Testing, Test Memory Above 1MB, etc).
Some BIOSes can (and still do) have code in them that can foil such attacks: RAM size detection. During startup, BIOSes used to automatically figure out the size of the attached memory modules by writing special patterns into memory, checking for repeats, and used this to determine rows/columns, etc. This has the side-effect of clobbering anything left over in memory. It wasn't foolproof though. The algorthim didn't always crush every byte in memory. And it was also usually skipped during a warm reboot. (Most of the older Award BIOSes use this memory-sizing method.)
In newer systems, there is a more standardized way of determining the memory module size/speed. It is called Serial Presence Detect (SPD). Basically, there is a tiny (~128byte) EEPROM on each memory module that specifies the brand/size/speed of the memory module. The BIOS reads the SPD EEPROMs on each modules to figure out the BIOS size. This eliminates the need to write to memory (bye-bye to the scrubbing effect). Most modern AMI and Phoneix BIOSes use this method.
For reference, we added added a "RAM Scrub" option to a BIOS for one of our products. It added ~8 seconds to the boot time to do a one-pass scrub 512MB of memory. Obviously more RAM would take longer to scrub.
Unfortunately, the BIOS scrubber doesn't guard against the attack of someone yanking power from the system and pulling out the memory modules. The attacker could then insert the modules into a non-scrubbing motherboard and read the RAM contents. If they were really clever, the could have some custom hardware to read it with zero BIOS interaction (FPGA or specialized procesor board with a DIMM socket). There are some primitive ways to guard against this, though (e.g. Epoxy the memory modules in place).