The Handles menu is a convenient way to allocate and free Win32 resource handles and track the events in Memory Validator.
Leaks are created by creating but not freeing each type of resource below.
The thread creation and thread deletion examples can test the detection of cross thread allocation.
•Start a thread and allocate some memory in it to be deallocated below •Stop the thread •The deallocation will happen from a different thread to the one that allocated. |
|
•Allocate a device context •Deallocate it |
|
•Get a device context using GetDC() •Release it using ReleaseDC() |
|
•Open a file. If the file is not closed the file handle will be leaked. •Close it |
|
•Create a font •Destroy it |
|
•Create a pen •Destroy it |
|
•Create a brush •Destroy it |
|
•Create an icon •Destroy it |
|
•Create a mouse cursor •Destroy it |
|
•Create a window •Destroy it |
|
•Create a bitmap •Destroy it |
|
•Extract an icon from a bitmap •Destroy the icon |
|
•Test the lifetime of a temporary CDC object |
|
•Map a view of a file into memory •Unmap the view |
|
•Create some regions using CreateRectRgn(),one of which leaks •See CTeststakView::OnRegionTests() |
The More Handles menu is...well, more of the same - i.e. convenient ways to create different types of handles and oberve the events in Memory Validator.
•Create some Timer Queue and Timer handles - see CTeststakView::OnTimerQueueTests()
•Create and MFC CFile object, write to it and then close it. |