Thick Client memory encryption

I came across a thick client application recently. The application temporarily stores sensitive data (like username and password) in clear text in memory and the data is flushed once the user logs out or the application is closed.

Inorder to increase the security implementation of the application is there any technique where I could encrypt the sensitive data stored in memory? so that data are encrypted whenever application memory is dumped.

Please suggest some resources for implementation.