views:

67

answers:

3

Hi. I have a program that I use as an alt-tab replacement. I wrote it in .NET, so it has a sizable memory footprint. Since I use it only occasionally, it tends to get paged. So when I call it up, it often takes a few seconds to display. This is very annoying. Is there a way to prevent it from being paged so that always comes up immediately?

I could always write it in a more lightweight language, but is there a solution short of that?

+1  A: 

A dirty trick is to put a timer in it, that triggers some useless (empty) computation every so often, to prevent (revert) pagination.

Mau
Hmm. I suppose if I created some appropriate WinForms object and disposed it on the timer it would keep the appropriate pages in memory. But I'd have to test a bit to find the right one. Oh, and maybe do a GC too to keep the heap in memory.
Chris
Just make the timer handler change some invisible property of the main form, thus forcing *it* to be in memory.
Mau
+1  A: 

Put lots of memory in your computer. It's unlikely that any solution involving software development would be cheaper than that.

Daniel Earwicker
:D ............
Mau
A: 

We dont have direct control over VM in C#. It may be possible to hook into VM with some advanced stuff like p/invoking something you write in C++ (Hans Passant could probly tell you all about that). You can also compile for x64 and run on 64-bit system with sufficient RAM and disable VM (I don't recommend disabling VM on a 32-bit system where you cap at 4GB's).

P.Brian.Mackey