Some applications, such as a web browser making a secure "https" connection to an e-commerce web site, or the GnuPG encryption suite, cannot have some of its data swapped out to the hard drive like any other bit of data. To swap out an encryption key puts that key at risk for future recovery. Even if the data on the hard drive is subsequently written over, a determined party with physical access to the drive will be able to recover that data.
In UNIX, the contemporary solution to this problem is mlock. An application using mlock can tell the operating system to not swap out a particular piece of code or data. The drawback is RAM is a precious resource; that is why swap space on the hard drive is used. Further, a rouge application can use mlock to lock a large chunk of data in RAM, starving other applications of RAM. Typical UNIX systems restrict mlock to "superuser" processes -- in other words, the mlock facility is not available to normal applications.
mcryptswap tells the operating system to ensure that if a particular piece of code or data needs to be swapped out, then the data is securely encrypted before being written to disk.
int mcryptswap(const void *addr, size_t len);
Operating systems should employ reasonable encryption algorithms and keep the encryption key in RAM.