📄 wguiheap.gml
字号:
.begbull $compact
.bull
Address
.bull
Handle
.bull
Owner (secondary sort=Type)
.bull
Size
.bull
Type (secondary sort=Owner)
.bull
Flag
.bull
Age (available for LRU Items list only)
.endbull
.np
For the Selector List
.begbull $compact
.bull
Base Address
.bull
Selector
.bull
Limit
.bull
Granularity
.bull
Type
.bull
DPL
.endbull
.*
.section *refid=viewmem Viewing the Contents of Memory
.*
.np
.ix 'Heap Walker' 'using window'
.ix 'Heap Walker' 'information display'
.ix 'information display' 'in Heap Walker'
You can view the data stored in an object that appears in one of the
lists displayed in the Heap Walker window by double clicking on the
desired object. This opens a Memory Display window for the object.
.*
.beglevel
.*
.section The Memory Display Window
.*
.keep 8
.figure *depth='0.87' *scale=64 *file='HW5' The Memory Display window displays the data stored in the selected object.
.np
.ix 'Heap Walker' 'Memory Display window'
.ix 'Memory Display window'
The Memory Display window displays all of the data stored in
the selected object. The data in this window appears
in hexadecimal form. The Memory Window is useful because it allows you
to see if the data in memory is what you believe it should be. Heap
Walker cannot display the Memory Display window for free items
or objects whose size equals zero.
.np
When you size the Memory Display window Heap Walker automatically reformats
the information so that it is the same width as the window.
.np
Some memory objects contain information representing graphical
objects used by Windows, such as menus, dialogs, cursors, and icons. When
you display the data for one of these objects in the Memory Display
window, Heap Walker also displays the object in graphical form. Occasionally,
this operation may fail for different reasons, including lack of memory and
the inability to read certain resource formats.
.np
If the object displayed is a menu then Heap Walker can tell you the
constant associated with any item in the menu. When the menu is
displayed in graphical form simply select an item from it. Heap Walker
will display a dialog that shows the name of the item selected and
the numeric constant associated with it. This numeric constant is
the number passed as the wparam parameter of a window's callback
function when the menu item is selected.
.np
.ix 'Heap Walker' 'Handle Information dialog'
.ix 'Handle Information dialog' 'in Heap Walker'
The Memory Display window is accompanied by an Information dialog
box. This section describes the Information dialog, as well as
the various functions you can perform within the Memory Display window.
Functions include saving, setting the display, and setting the offset.
.*
.beglevel
.*
.section Saving Heap Walker Information to a File
.*
.np
.ix 'Heap Walker' 'save'
.ix 'save' 'in Heap Walker'
The Save items in Heap Walker allow you to save the information
displayed in a window to a text file. Saving information to a file
allows you to do many things, including:
.begbull $compact
.bull
print the output later
.bull
compare objects outside of Heap Walker
.bull
annotate the text file on-line
.endbull
.np
Choosing Save from the File menu on the Memory Display window
saves the data in the window to a file name generated by Heap Walker
based on the information in the Configuration dialog.
A message box appears indicating the path to which Heap Walker
saved the file.
.np
.ix 'Heap Walker' 'save as'
.ix 'Save As' 'in Heap Walker'
Choosing Save As from the File menu allows you to specify the file
to which you want to save the data currently in the window. This opens a
Save As dialog box where you select the desired file. Click on OK when
completed. A message box appears indicating the path to which Heap
Walker saved the file.
.*
.section Changing the Heap Walker Display
.*
.np
.ix 'Heap Walker' 'change display'
.ix 'display' 'change in Heap Walker'
There are five ways to display the information in the Memory Display
window. You can display the information as:
.begbull $compact
.bull
Bytes
.bull
Words
.bull
DWords
.bull
16-bit Code
.bull
32-bit Code
.endbull
.np
To change the form of the displayed data, select an item from the
Display menu.
.br
When displaying data in bytes, the data appears in the window as it
physically appears in memory. When the data is displayed as words, the
bytes in memory are interpreted for you so that the values displayed are
those that would be obtained by treating the memory as an array of words.
For example, if memory containing the values:
.millust begin
12 34 56 78 9A BC DE FF
.millust end
.pc
was shown as words, the memory window would display:
.millust begin
3412 7856 BC9A FFDE
.millust end
.pc
A similar interpretation is performed when the data is displayed as DWords.
If the above memory was shown as DWords, the memory window would display:
.millust begin
78563412 FFDEBC9A
.millust end
.pc
This rearrangement of bytes does not affect the textual interpretation of
the data shown on the right hand side of the window.
.np
Selecting 16 or 32 Bit Code from the Display menu presents the data in a
disassembled form. Sometimes presenting the data in disassembled form is
not accurate. This is because when Heap Walker disassembles the data it
begins at the first byte of the memory block and disassembles it linearly.
If a byte in this block, such as a padding byte, throws off the sequence,
the disassembly will be meaningless.
.*
.section Setting the Offset in the Memory Display Window
.*
.np
.ix 'Heap Walker' 'set offset'
.ix 'offset' 'set in Heap Walker'
In the Memory Display window, selecting the Set Offset item from
the menu bar allows you to reposition the data so that the specified
line appears at the top of the window. The offset you enter appears on
the first line. It will not necessarily be the first piece of
information because rounding often occurs to avoid breaking a line.
.begstep
.step Choose Set Offset
.ix 'Set Offset option' 'in Heap Walker'
from the menu.
.result
This opens a Goto Offset dialog box.
.keep 15
.figure *depth='2.26' *scale=100 *file='HW6' In the Goto Offset dialog, enter the offset you want to appear at the top of the Memory Display window.
.step Enter the desired offset
that you want to position at the top of the Memory Display window.
You can enter the offset in decimal or hexadecimal form. However, you must
prefix hexadecimal values with 0x (e.g. 0x00000005).
.step Click on OK.
.result
This closes the dialog and positions the data as requested.
.endstep
.*
.section Information Dialog Boxes
.*
.np
.ix 'Handle Information dialog'
.ix 'Heap Walker' 'Handle Information dialog'
A Handle Information dialog box attached to the Memory Display window
provides the information that appears on the Heap Walker window for
the displayed object. The information in this dialog is:
.begbull $compact
.bull
Block Address
.bull
Block Handle
.bull
Block Size
.bull
Lock Count
.bull
Page Lock Count
.endbull
.keep 11
.figure *depth='1.62' *scale=100 *file='HW7' The Handle Information dialog box displays information for the selected object.
.np
.ix 'Selector List' 'in Heap Walker'
.ix 'Heap Walker' 'selector list'
When the selected display is the Selector List, the Selector Information
dialog box is attached to the Memory Display window. The information in this
dialog is:
.begbull $compact
.bull
Selector
.bull
Base
.bull
Limit
.bull
Type
.bull
DPL
.bull
Granularity
.bull
Access
.endbull
.keep 13
.figure *depth='1.98' *scale=100 *file='HW8' The Selector Information dialog displays the Selector List information for the selected object.
.np
.ix 'Auto Position Info'
.ix 'Heap Walker' 'Auto Position Info'
The information boxes stay with the Memory Display window when the
Auto Position Info item under the File menu is checked.
Uncheck this item by selecting it again from the File menu.
.np
.ix 'Show Info' 'in Heap Walker'
.ix 'Heap Walker' 'show info'
If the information dialog is not visible, reveal it
by choosing Show Info from the File menu on the Memory Display window.
Close this dialog by double clicking on the system menu box in the
upper left hand corner of the dialog.
.*
.endlevel
.*
.endlevel
.*
.section Working with Individual Objects
.*
.np
.ix 'Objects menu' 'in Heap Walker'
.ix 'Heap Walker' 'Objects menu'
The items in the Object menu enable you to operate on the individual
objects on the global heap.
.begpoint The Object Menu
.point Show
View the data stored in an object.
.point Get Selector
Show the Selector corresponding to a Handle.
.point Discard
Request that a discardable object be purged from memory.
.point Oldest
Reposition an object to become the oldest object on the LRU list.
.point Newest
Reposition an object to become the newest object on the LRU list.
.point Add
Calculate and display the amount of memory used by selected objects.
.endpoint
.np
These items allow you to quickly set up test situations
while developing a program. For example, if you suspect your program has
a bug caused by the system discarding a particular object, you
can use the Newest item to force the system to keep that object. Similarly,
you can discard an object that you suspect is causing a bug to see if
your program runs without it.
.np
Some items apply only to specific objects. To reposition and
discard objects, the selected object must be a discardable item.
When the Selector List is displayed only the Show item
is available.
.*
.beglevel
.*
.section Viewing an Object's Memory
.*
.np
.ix 'Memory' 'view an object's'
.ix 'Object memory'
.ix 'Heap Walker' 'view object's memory'
Viewing an object's memory is useful because it allows you to see
if what is actually in memory is what you think should be in memory.
There are two ways to view an object's memory:
.begbull $compact
.bull
Double click on the desired object
.br
or
.br
.bull
Click once on the desired object to select it and choose Show from
the Object menu.
.endbull
.np
This opens a Memory Display window for the selected object.
.np
You can save the information on this window to a file and change the
way in which the window displays the memory information. Refer to the
section
:hdref refid='viewmem'.
for details on these functions.
.*
.section Finding a Selector
.*
.np
.ix 'Get Selector'
.ix 'Heap Walker' 'Get Selector'
The Get Selector function locates the selector for any object with a
handle. You need to know the selector to get the logical address in
memory of an object. This function is not available for free items
or objects without handles.
.np
To find the selector for an object:
.begstep
.step Click once on the object whose selector you want to find.
.step Choose Get Selector
from the Object menu.
.result
This opens a message box which indicates the Selector that
corresponds to the selected memory object.
.step Click on OK
to close the message box.
.endstep
.*
.section Discarding an Object
.*
.np
.ix 'Discard option' 'in Heap Walker'
.ix 'Heap Walker' 'Discard option'
The Discard item allows you to request that the system purge a
discardable object from memory. Only objects marked by the operating
system as discardable can be discarded.
.np
Choosing this item is equivalent to making the API call GlobalDiscard for
the selected object.
.np
To discard an object:
.begstep
.step Click once on the object you want to discard.
.step Choose Discard
from the Object menu.
.result
This opens a message box which indicates the Handle of the object
discarded, as well as the number of bytes discarded.
.step Click on OK
to close the message box.
.endstep
.*
.section Repositioning an Object
.*
.np
.ix 'Object' 'reposition'
.ix 'Heap Walker' 'reposition object'
Repositioning objects allows you to force discardable objects to be the
oldest or newest object on the LRU list. The system discards objects
from memory when there is not enough free memory available to satisfy
an allocation request from a program. Giving an object the status Oldest
ensures that if the system discards objects from memory, this will be
the first object discarded. Giving an object the status Newest ensures
that when the system removes memory, this will be the last object removed.
.np
To reposition an object:
.begstep
.step Click once on the object you want to reposition.
.step Choose Oldest or Newest
.ix 'Object' 'oldest or newest'
.ix 'HeapWalker' 'newest or oldest object'
from the Object menu,
depending on how you want to reposition the object in the list.
.result
This opens a message box which indicates the handle of the object
that has been repositioned in the selected manner.
.step Click on OK
to close the message box.
.endstep
.*
.section Calculating Memory Size
.*
.np
.ix 'Memory Size' 'calculating'
.ix 'Heap Walker' 'calculating memory size'
.ix 'Heap Walker' 'Add function'
.ix 'Add function' 'in Heap Walker'
The Add function is a summary function you use to calculate the memory
size of selected objects.
.ix 'memory leaks'
This function may be helpful in identifying memory leaks.
.np
A memory leak occurs when a program allocates memory but does not free
it when the memory is no longer needed. If a program has a memory leak
it requires increasingly more memory as it runs. With the Add function
you can quickly determine the amount of memory being used by your
program at any point in time. This allows you to determine if its
memory requirements are increasing over time.
.np
Choosing Add from the Objects menu opens an Add dialog box.
.keep 13
.figure *depth='1.92' *scale=100 *file='HW9' As you select objects, the Add function calculates and displays the number of selected objects and their total size.
.np
During an Add operation the global heap list acts as an extended selection
list box. There are several ways to select objects in an extended
selection list box. The following describes three common selection
techniques you can use.
.begbull
.bull
Select one object by clicking on it. The Add dialog displays the size
of the selected item.
.bull
Select multiple objects by holding the CTRL key and clicking on
each object one at a time. The Add dialog displays the number of
objects selected and the total size of those objects.
.bull
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -