Application Verifier: Save your memory! Debug your apps! Also, hax.

Application verifier is a nifty application that Microsoft introduced for Windows XP around 2001. This testing tool is also useful for if you want to troubleshoot Windows applications.  For example, if you notice a process that is getting out of hand with memory resources, you can simulate an environment where this application can’t allocate more than, say 500 MB of memory.

Getting application verifier

You can download 32 and 64-bit versions of application verifier from the Microsoft download center and can read some notes about application verifier on MSDN.

When you install application verifier and run it, you will see a screen like the following:

Application Verifier screenshot

Not that exciting, yes?  Well, let’s make it interesting. On the left side of the application is a list of the applications that you have configured to run with application verifier.  We don’t have any configured yet, so let’s add one!  Click File->Add application or press Ctrl+A:

I’ll add Adobe Reader 🙂  Once you have the application added to the list of applications, it will appear at left and you can do all sorts of stuff in the “tests” section of the application to constrain the application.

A screenshot of tests for application verifier

Right clicking on tests lets you set more properties on the tests, for example, you can set the specific resources that you are restricting as shown in the following screenshot:
A screenshot showing application verifier properties such as heap_alloc

Yeah, that’s right.  You can limit an application’s heap size, explicitly set timeouts for triggering the “app is not responding” and all other sorts of magic.

** Update ** This may be incorrect. As mentioned in the comments, the ALLOC values do not correspond to limits on heaps but instead correspond to the error frequency – higher values mean more frequent allocation errors, lower values approach zero errors.

Why do I care?

Scenario 1: testing with application verifier

Application verifier is an excellent test tool for:

  • Finding memory leaks early: simply crank down your application resources and run your app for a little bit.
  • Seeing that your application plays nice when it’s not run as administrator

Scenario 2: application verifier hacks

This is the fun part 🙂  Let’s say you have an application, for simplicity, we’ll call it emorhc.  So let’s say this application tends to get process and memory sizes that are a little out of hand.  You can add it to application verifier, limit it’s heap, and like magic, it will not hoard your system memory.

Conclusions

Check out application verifier, it’s the bomb.