Image credit: http://www.lowflo.ie/ |
In my current project that involves Microsoft technology, 3rd party application has a memory leak. In this post I will explain how I detected memory leak and how I tried to override memory leak by enlarging memory space for that application.
You all probably know for Windows task manager, but to get all information about Windows process, much better and enhanced option is Process Explorer. It provides all details that you need when yo are investigating all resources that process consumes.
Application with memory leak is 32 bit application. 32 bit denotes size of address space for that application, and that is 2GB (2^31), In Process Explorer right click on process that you want to monitor, choose properties and select Performance tab. Virtual memory is memory available for that process. When it hits 2GB value, your application will throw out of memory exception. Application has memory leak if virtual memory consumption raises over time. Application was running in Windows Server 2012 64 bit edition, but as was 32 bit application, that did not helped.
My heuristic was: is it possible that 32 bit application address more than 2GB on 64 bit OS?
I found this simple utility, 4GB patch. I patched executable that manifested memory leak in process explorer, and now 32 bit application was able to address 4GB!
Process Explorer in action. Image credit: http://technet.microsoft.com/ |
That actually helped just for one scenario, when test run was shorter than time needed for application to hit 4GB limit.
In this problem I had 3rd party application, which means that I could not remove cause of actual memory leak. Using process explorer, I had information what could be the problem, because process explorer shows which DLLs are loaded during the application operation.