The Linux Kernel can free memory; the balloon driver included in all kernels allows it to dynamically shrink and grow memory with a variety of urgency levels and the kernel can (optionally) shrink memory itself once it's not needed based on various parameters. It's fairly reliable and works well.