Is it possible to force a specific program to remain in memory after closing it? Alfred is great, of course, and I use it all the time. However, if I haven't opened it for a little while it can take a few seconds to open the search-bar UI. Otherwise, it will open in less than a quarter of a second.

I believe this is to do with the fact that it is moved out of memory by the operating system, meaning it has to be copied back in next time I request it (note: I have a mechanical hard-drive, not an SSD, so that takes ages).

So my question is this: can I force macOS to leave an application in main memory even if I'm not using it?
MacOS's memory management is quite sophisticated, and it generally does try to keep as much stuff in memory as possible. If Alfred is still running, then it will be in memory. 

If you have quit Alfred, then it might still be retained in memory, which is why it is faster to load next time. However, the OS will clear the quit app from memory, if the memory is needed for something else. So you might experience slowness somewhere else if you don't let the OS clear the quit app.

Recommendations for improving speed:


Leave Alfred running all the time. If it's slow to come to foreground sometimes, even when its been running in the background, then that's not a memory issue, but something else: possibly related the slowness of the HDD.
Get more RAM, if possible. You don't say what model of Mac and how much RAM.
Replace the HDD with an SSD.