Option 1: tmpfs or another memory backed fs
Option 2: Quick C program, but two gotchas: make sure you touch every page after allocating (and keep touching it, otherwise they will be swapped out)
(Also turning off or limiting swap space may be helpful)