How to keep program always in memory (no swapping)

7

0

I'm using KeePass (on Windows 7) for storing passwords. The application is running on my laptop almost 100% of the time, but I'm using it rarely.

The problem is, that activating the window after long time takes huge amount of time, I'd say that OS realized the application is no longer used and swapped it.

I don't want OS to swap my KeePass (because of the loading lag, and also because of security - I don't like the idea of password keeping program's memory to be stored anywhere on HDD).

Is there any possibility how to tell OS not to swap some program? Or, is this achievable by some programming?

nothrow

Posted 2012-11-29T18:11:26.400

Reputation: 215

For what it’s worth, I for one understand exactly what you mean Yossarian. Obviously the other people either have not experienced it, or have not noticed it. I too would love to find a way to prevent a program (a specific instance of cmd.exe in my case) from being swapped so that I can switch to it instantly, even when the system is bogged down with swapping and CPU load. Unfortunately, I can’t imagine such a mechanism would exist since it could easily be abused by malware. :-( – Synetech – 2015-11-25T17:09:12.797

4

KeePass does not store unencrypted passwords in memory. So any swapping should not pose a security risk. http://keepass.info/help/base/security.html#secmemprot

– Der Hochstapler – 2012-11-29T18:22:30.650

1And, one sure way to disable paging (Windows does not perform swapping) is to disable the paging file altogether. :) – Der Hochstapler – 2012-11-29T18:24:11.557

3Also from the page @OliverSalzburg linked to: "KeePass ≥ 1.15 and 2.x use the Windows DPAPI for in-memory encrypting the sensitive data. With DPAPI, the key for in-memory encryption is stored in a secure, non-swappable memory area managed by Windows." So even the key is never saved to disk with that option enabled (which it is by default). – Karan – 2012-11-29T18:25:08.970

Thanks guys, I thought so, but I was not so sure. However, loading lag is still bugging me, the computer doesn't have enough memory to keep everything in it :( – nothrow – 2012-11-29T20:18:29.660

make sure Superfetch service is running. The fixes the issue you have. – magicandre1981 – 2012-12-06T21:25:46.617

Keepass archives can be configured upon creation to require a very large number of transformations upon entry of a password before the data is decrypted. If your keepass workspace is locking and requiring re-entry of the password when you restore it, the delay you are experiencing might simply be an intentionally-long decryption process. Have you tried using a different keepass file (Security tab under Datbase Settings when creating a new workspace defines the decryption delay)? – Fopedush – 2012-12-06T23:00:28.670

@Fopedush, no, the delay is caused by OS. It is clearly visible, that it takes ~20-30 seconds before the dialog for entering password even shows (I've got slow laptop). Also, in Resource Monitor there is peak in I/O operations during this lag. – nothrow – 2012-12-07T13:42:52.680

Answers

1

There are plenty of people who will tell you that it's a bad idea to disable swap/pagefile.

If you decide it is something you wish to do, however, you can:

  • Right-click Computer
    • Click Properties
  • Click Advanced System Settings
    • Click Advanced tab
  • Click Performance
    • Click Advanced tab
    • Click Virtual Memory - Change

Here, you can make changes to where and how much pagefile you are using. I'm pretty sure everybody will agree that moving your pagefile off of your SSD and putting it onto a HDD would be a good idea, but completely disabling it could cause problems.

earthmeLon

Posted 2012-11-29T18:11:26.400

Reputation: 322

This isn't something I want to do, as I want disabling swapping just for one process. I'd say that disabling pagefile at all is bad idea too :-) – nothrow – 2012-12-04T13:48:19.367

Sorry, I'm being told by multiple sources that it's an all or nothing type situation. Sorry I couldn't be of further help. – earthmeLon – 2012-12-04T16:32:57.227