{"id":36,"date":"2011-10-31T07:07:44","date_gmt":"2011-10-31T07:07:44","guid":{"rendered":"http:\/\/blog.gusclass.com\/?p=36"},"modified":"2012-12-07T23:58:34","modified_gmt":"2012-12-07T23:58:34","slug":"application-verifier-save-your-memory-debug-your-apps-also-hax","status":"publish","type":"post","link":"http:\/\/gusclass.com\/blog\/2011\/10\/31\/application-verifier-save-your-memory-debug-your-apps-also-hax\/","title":{"rendered":"Application Verifier: Save your memory! Debug your apps!  Also, hax."},"content":{"rendered":"<p>Application verifier is a nifty application that Microsoft introduced for Windows XP around 2001.\u00a0This testing tool is also useful for if you want to troubleshoot Windows applications.\u00a0 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\u2019t allocate more than, say 500 MB of memory.<\/p>\n<p><strong>Getting application verifier<\/strong><\/p>\n<p>You can <a href=\"http:\/\/www.microsoft.com\/download\/en\/details.aspx?id=20028\">download 32 and 64-bit versions of application verifier from the Microsoft download center<\/a> and can <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms220948(v=vs.90).aspx\">read some notes about application verifier on MSDN<\/a>.<\/p>\n<p>When you install application verifier and run it, you will see a screen like the following:<\/p>\n<p><a href=\"http:\/\/blog.gusclass.com\/wp-content\/uploads\/2011\/10\/app-verifier.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-37\" title=\"Application Verifier screenshot\" src=\"http:\/\/blog.gusclass.com\/wp-content\/uploads\/2011\/10\/app-verifier.png\" alt=\"Application Verifier screenshot\" width=\"530\" height=\"367\" \/><\/a><\/p>\n<p>Not that exciting, yes?\u00a0 Well, let&#8217;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.\u00a0 We don&#8217;t have any configured yet, so let&#8217;s add one!\u00a0 Click File-&gt;Add application or press Ctrl+A:<\/p>\n<p><a href=\"http:\/\/blog.gusclass.com\/wp-content\/uploads\/2011\/10\/add-app.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-38\" title=\"add app\" src=\"http:\/\/blog.gusclass.com\/wp-content\/uploads\/2011\/10\/add-app.png\" alt=\"\" width=\"532\" height=\"289\" \/><\/a><\/p>\n<p>I&#8217;ll add Adobe Reader \ud83d\ude42\u00a0 Once you have the application added to the list of applications, it will appear at left\u00a0and you can do all sorts of stuff in the &#8220;tests&#8221; section of the application to constrain the application.<\/p>\n<p><a href=\"http:\/\/blog.gusclass.com\/wp-content\/uploads\/2011\/10\/app-verifier-tests.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-39\" title=\"app verifier tests\" src=\"http:\/\/blog.gusclass.com\/wp-content\/uploads\/2011\/10\/app-verifier-tests.png\" alt=\"A screenshot of tests for application verifier\" width=\"526\" height=\"306\" \/><\/a><\/p>\n<p>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:<br \/>\n<a href=\"http:\/\/blog.gusclass.com\/wp-content\/uploads\/2011\/10\/app-verifier-resources-props.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-40\" title=\"app verifier resources props\" src=\"http:\/\/blog.gusclass.com\/wp-content\/uploads\/2011\/10\/app-verifier-resources-props.png\" alt=\"A screenshot showing application verifier properties such as heap_alloc\" width=\"530\" height=\"450\" srcset=\"http:\/\/gusclass.com\/blog\/wp-content\/uploads\/2011\/10\/app-verifier-resources-props.png 530w, http:\/\/gusclass.com\/blog\/wp-content\/uploads\/2011\/10\/app-verifier-resources-props-300x254.png 300w, http:\/\/gusclass.com\/blog\/wp-content\/uploads\/2011\/10\/app-verifier-resources-props-353x300.png 353w\" sizes=\"(max-width: 530px) 100vw, 530px\" \/><\/a><\/p>\n<p>Yeah, that&#8217;s right.\u00a0 You can limit an application&#8217;s heap size, explicitly set timeouts for triggering the &#8220;app is not responding&#8221; and all other sorts of magic.<\/p>\n<p><strong>** Update **<\/strong> 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 &#8211; higher values mean more frequent allocation errors, lower values approach zero errors.<\/p>\n<p><strong>Why do I care?<\/strong><\/p>\n<p>Scenario 1: testing with application verifier<\/p>\n<p>Application verifier is an excellent test tool for:<\/p>\n<ul>\n<li>Finding memory leaks early: simply crank down your application resources and run\u00a0your app for a little bit.<\/li>\n<li>Seeing that your application plays nice when it&#8217;s not run as administrator<\/li>\n<\/ul>\n<p>Scenario 2: application verifier hacks<\/p>\n<p>This is the fun part \ud83d\ude42\u00a0 Let&#8217;s say you have an application, for simplicity, we&#8217;ll call it emorhc.\u00a0 So let&#8217;s say this application tends to get process and memory sizes that are a little out of hand.\u00a0 You can add it to application verifier, limit it&#8217;s heap, and like magic, it will not hoard your system memory.<\/p>\n<p><strong>Conclusions<\/strong><\/p>\n<p>Check out application verifier, it&#8217;s the bomb.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Application verifier is a nifty application that Microsoft introduced for Windows XP around 2001.\u00a0This testing tool is also useful for if you want to troubleshoot Windows applications.\u00a0 For example, if you notice a process that is getting out of hand&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11],"tags":[24,31,283,43],"amp_validity":null,"amp_enabled":true,"_links":{"self":[{"href":"http:\/\/gusclass.com\/blog\/wp-json\/wp\/v2\/posts\/36"}],"collection":[{"href":"http:\/\/gusclass.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/gusclass.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/gusclass.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/gusclass.com\/blog\/wp-json\/wp\/v2\/comments?post=36"}],"version-history":[{"count":4,"href":"http:\/\/gusclass.com\/blog\/wp-json\/wp\/v2\/posts\/36\/revisions"}],"predecessor-version":[{"id":300,"href":"http:\/\/gusclass.com\/blog\/wp-json\/wp\/v2\/posts\/36\/revisions\/300"}],"wp:attachment":[{"href":"http:\/\/gusclass.com\/blog\/wp-json\/wp\/v2\/media?parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/gusclass.com\/blog\/wp-json\/wp\/v2\/categories?post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/gusclass.com\/blog\/wp-json\/wp\/v2\/tags?post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}