CONFIG_VIRTIO_BALLOON=y (Virtualization -> Virtio balloon driver)
There are even drivers for Windows which are available here: Link
After turning on you can connect to the qemu monitor via netcat or telnet. Too see the actual memory of the guest you only have to type:
(qemu) info balloon
The syntax for increasing or decreasing the memory is:
(qemu) balloon 1024
This command will change the memory allocation to the specified amount in MB. Looking at the above example it would be 1024MB.