Thursday, September 6, 2012

Give Me Back Some Memory

NTSTATUS: STATUS_MEMORY_LOW

What we have here, is a small, tiny, and efficient classic good old fashioned Windows (Win32) app: MemRecover.exe. It also has no actual functional UI/window other than an About dialog, and a tray icon and context menu. Since the app’s purpose is to recover memory, it’d be ironic if it itself is bloated and chews up memory.

OK, so there are other tools out there that can help you optimize and recover memory. Some are pretty nice, but I wanted something small and only did one thing, so I wrote one. Is it really necessary? For me, a little, because I use apps that suck your computer’s blood, I mean memory dry. I don’t want to name names. *COUGH-FIREFOX-COUGH*

The app takes two parameters:

MemRecover.exe [memory%] [interval]

memory%: value from 1 to 100. This is the percentage of physical memory used (threshold) which will cause a round of memory recovery. The default value if no parameter is specified is at 90%

interval: in seconds, the interval between each memory usage check. The default value if no parameter is specified is 60 seconds

You can create a shortcut for the app and add the parameters into it as such:

MemRecover shortcut

The tray icon:

  • Double-clicking it triggers a memory recovery
  • Right-clicking it brings up a context menu, the items all of which should be obvious:
    • Recover Memory
    • About…
    • Exit

As for what’s happening with the app, it provides some information via debug strings. You may use DebugView from Sysinternals to capture them if you’re interested.

Depending on the process you have running, I’ve been able to recover up to 700+ MB of physical memory during a recovery event. For my limited RAM, that’s significant. And maybe it’s good pruning now and then.

MemRecover can be downloaded here: x86 | x64

The MSVC runtime DLL’s are included in case you need them.

No comments:

Post a Comment