From Collaborative RCE Tool Library

Jump to: navigation, search

Red Gate Memory Tracker

Tool name: Red Gate Memory Tracker
Rating: 0.0 (0 votes)
Author: Red Gate Software                        
Website: http://labs.red-gate.com/index.php/Red_Gate_Memory_Tracker
Current version: 0.2
Last updated: July 2006
Direct D/L link: Locally archived copy
License type: Free
Description: Every so often I find I'm working on an application and my task is to work out why it's using so much memory. I've had this problem at various different companies. "Product X has a massive memory footprint, and we need to reduce it. Find out why it's taking up 1GB of RAM even before we throw real data at it."

With existing tools this can be extraordinarily difficult. Using the Visual Studio debugger doesn't prove to be much help. All you can see are the loaded modules, and you can calculate their sizes by doing a dir at a command prompt, or through Explorer. Windows Task Manager will tell you how much virtual memory your application is using, but not what it's using it for. Process Explorer, from http://www.sysinternals.com, is also very handy, and can save you a bit of trouble; but it still won't tell you where all your memory's going.

Googling has, on numerous occcasions, generally provided nothing of value. The best I've found are applications which will give you a linear, text list of all the virtual memory memory blocks allocated in the process, and how much space each consumes.

Recently I discovered the process was improved somewhat by using WinDbg. For both managed and unmanaged applications, assorted WinDbg extensions prove extraordinarily handy, provided you know the correct mojo to invoke. Even so, you're left with what is basically a highly manual task.

Enter Red Gate's Memory Tracker (a highly provisional name, by the way), which attempts invoke Red Gate's mantra of ingeniously simple tools, and provide you a one-stop, automated, graphical way of solving this problem.

Simply fire up the Memory Tracker and choose a running process from the drop down. Memory Tracker will analyse the process' memory usage, and provide you with a graphical memory map of the entire user address space. You can pan around by clicking the left button and dragging; you can zoom in and out with the mouse wheel.

Memory blocks are colour coded to indicate their content type, and patterned to indicate the access controls on that memory. Mouse over the memory block for more information: a tooltip will describe the memory content type, sub type, and any additional information available.

Take for example the memory occupied by a DLL. PE files (that's DLLs and executables) are split into sections, containing code, read-only data, and writeable data. When the DLL is loaded, those sections are preserved in memory. So in the Memory Tracker, you can see not only which DLLs are loaded, and the relevant product, version and company information for that library, but the size of each individual section in the library. You can visually distinguish between code blocks, static data blocks, and writeable data blocks.

The Memory Tracker doesn't just identify DLLs. It can display memory used by both system (Microsoft) and user (non-Microsoft) DLLs; memory on Windows process heaps, both allocated and free; memory on .NET heaps, both the managed heap and the large object heap; memory consumed by the .NET runtime for other purposes (such as JIT code compilation); and general virtual memory, both reserved and committed. Of course, it also shows you free memory.

Although I'm somewhat biased, I find this a vaguely entertaining tool to use. Run it against SQL Server to see the large memory blocks SQL Server reserves for efficiency purposes (and watch that memory get fragmented over time). Run it against Visual Studio after you've had the application open for a few days on multiple projects, and observe that all those projects' libraries are still in memory. Run it against any application which accesses SQL Server (including some of Red Gate's leading tools) and observe the vast number of DLLs which have to be loaded for this purpose.
Related URLs: No related URLs have been submitted for this tool yet


Screenshot:
Screenshot of Red Gate Memory Tracker


RSS feed Feed containing all updates for this tool.

You are welcome to add your own useful notes about this tool, for others to see!



If you find that any information for the tool above is missing, outdated or incorrect, please edit it!
(please also edit it if you think it fits well in some additional category, since this can also be controlled)


Views
Category Navigation Tree
   Needs New Category  (3)