Just create a RAM Disk with the size 2 GiB to reduce available RAM for the system and running applications.
To get the necessary number of blocks to create such a disk, multiply (RAMdiskSize in MB)*2048.
In your example that's 2048*2048=4194304.
Then open Terminal and enter:
diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nomount ram://4194304`
You will get a message similar to that one:
Started erase on disk9
Unmounting disk
Erasing
Initialized /dev/rdisk9 as a 2 GB HFS Plus volume
Mounting disk
Finished erase on disk9 RAM Disk
then use dd and the path to the volume and fill the disk with random data:
dd if=/dev/random of=/Volumes/RAM\ Disk/random.dat bs=1024k
The command will write 1 MiB chunks of random data to the file random.dat in the RAM Disk volume until it's filled to capacity.
This should artificially reduce your available RAM by ~2 GiB until you unmount the RAM Disk or restart your Mac.
After some testing this doesn't seem to work as reliably as in older system. The reason is the new memory management in the latest systems (10.9 and up).
The memory used by the RAM Disk shouldn't be swapped to disk but depending on the quality of the random data file it might be compressed a little bit. You may increase the RAM Disk size by 5-10% to ~2.1 GB to get a more realistic picture.
If you want to do this in 10.5-10.8 the following command seems sufficient to get a reliable result (to get the Disk Identifier check the output of the diskutil...
command):
dd if=/dev/zero of=/dev/rdisk9 bs=1m