Windows has a CryptProtectMemory() function [1] that can be used to encrypt in-memory secrets using an OS-allocated session key. As far as I know the key is stored in non-paged memory in kernel memory space.
On Linux, libgcrypt can do encrypted malloc, which might also help.
[1] http://msdn.microsoft.com/en-us/library/windows/desktop/aa38...