This article explains how to start investigating a MemReplay log file. Please refer to Getting Started with MemReplay and Setup and Loading data with MemReplay Tool if you have not yet successfully loaded a .zmrl file.
Chapters:
If you have loaded a .zmrl file into the MemReplay Tool you will see something similar to the following screenshot.
The example log file which has been loaded here is showing all the allocations for life cycle:
starting the executable -> main menu -> loading forest level -> reaching spawn point -> player interaction possible
The By Allocation Event window and the By Frame window both represent the same memory allocations. However, they differ in the way they display them:
There are three lines with different colors (Requested, Consumed and Pagefile) which have different memory usage meanings:
The color of the three lines (Requested, Consumed and Pagefile) can be adjusted by selecting the right tab.
New markers are added inside the code by making use of the macro MEMSTAT_LABEL, MEMSTAT_LABEL_FMT or MEMSTAT_LABEL_SCOPED
The following example shows, how memory allocations are investigated. Select an area inside the By Allocation Event or the By Frame window.
In the top bar, click the D button which gives you view selection details.
Then press Go!
The Alloc Ev Range is representing the actual selection and can be adjusted if required.
This opens a new tab which looks similar to the one in the following screenshot. By clicking on the green memory block, the callstack on the left is updated.
In this example the memory block and callstack reveal that 6.4MB have been allocated by Create2DTexture() in the range specified.
Selecting the Code tab at the bottom shows you the actual position inside code.
Pressing the D button again after selecting a function from the callstack will invoke a jump to the line of code in Visual Studio. Note it is required to have the solution already opened in Visual Studio.
Getting more information about the memory block is easy. Select the memory block you want to explore and click on the C button on the top bar to show the context tree.
This gives a summary of the items which together form the memory block you have selected.
In this example, the 6.4MB memory block consists of textures such as blood_anim_a.dds, foam_tiled2.dds and others.
Context tree information can programmatically be added by using macros MEMSTAT_CONTEXT and MEMSTAT_CONTEXT_FMT
A categorized context tree can be generated from Tools -> Build context trees. If no area is selected, then it will be generated for the complete life cycle of the capture log.