Research & Development

Process Memory Utility

Posted on Aug 02, 2007, 4:00 am
The amount of content that needs to be managed, converted and otherwise manipulated by our PC tools never stops growing. Games are getting bigger all the time. The struggle with hard drive space, memory and network speed is part of a constant battle to keep production moving. Rob Wyatt wrote this handy little utility to help track memory usage in different processes running under some of our Windows boxes.
 
From Rob:
“Attached is a very crude app that will dump the memory map of a running Win32 process, in addition to the memory map it tells you the type of pages in each allocation and tries to map each allocation to a loaded module, if the allocation is assigned to a loaded module the name of the EXE/DLL is printed along side.
 
After the memory map it will display the amount free address space, the largest free block, the amount of address space reserved and the amount committed.
 
If you run the tool without any options it will dump all the processed and their PIDs, to look at a specific process pass the PID on the command line, the process has to be running. If you want to put this code into an application so it can dump its own memory map while it is running you can just cut the guts out (basically you need to use VirtualQuery instead of VirtualQueryEx).
 
You could extend this to do much more, you could find the data and BSS sections of DLLs, memory that is mapped to a named section could display info about the section. You could find heaps within the process, you could locate the stack within the process etc etc.”
 
 
To build (with gcc):
$ g++ –O3 process_mem.cpp –o process_mem –lpsapi
 
0

0 COMMENTS

BE THE FIRST TO LIKE THIS     LIKE     COMMENT

LEAVE A COMMENT



You must be logged in to add a comment
LATEST ARTICLES