The Allocation menu tests and demonstrates different groups of allocation, reallocation and deallocation examples.
Each test is listed below with the source code location in the example application.
Click on the picture below to jump to the relevant sections:
Allocation menu
C Runtime (C/C++) Heap submenu
...
Tests CRT heap allocation functions.
|
OnTestAllocatememory() Prompts for a number of bytes to allocate and how many times to do it. The memory is not deallocated. |
|
OnTestReallocatememory() Prompts for a number of bytes to allocate and how many times to reallocate it, growing in size each time. The memory is not deallocated. |
|
OnTestAllocateusingmalloc() Allocates 100 bytes of memory. The memory is not deallocated. |
|
OnTestAllocateusingcalloc() Prompts for a number of bytes to allocate. The memory is not deallocated. |
|
OnTestExpandmemoryusingexpand() Allocated memory and then expands it using _expand(). Two more calls to expand the memory pass incorrect memory pointers. |
|
OnTestShrinkmemoryusingexpand() Allocates memory and then shrinks it using _expand(). Two more calls to shrink the memory pass incorrect memory pointers. |
|
OnTestAllocatecobject() Allocates a CWnd object. |
|
OnTestAllocatecstring() Allocates various TestClass objects freeing all but one. |
|
OnTestMultipleallocationofcobject() Allocates 5 CWnd objects. |
|
OnTestMultipleallocationofcstring() Allocates 5 CString objects |
|
OnTestMultipleallocationofcobjectLeaving1() Allocates 5 CWnd objects, then deletes 4 of them |
|
OnTestMultipleallocationofcobjectLeaving2() Allocates 5 CWnd objects, then deletes 3 of them |
|
OnTestMultiplereallocation() Allocates and reallocates 3 pointers in a loop so the callstacks for each allocation are identical. |
|
OnMultiAlloc() Prompts for a number of allocations to make, each of random size. Allocations are freed |
Allocation menu
Heap submenu
...
Tests Win32 heap functions HeapCreate(), HeapDestroy(), HeapAlloc(), HeapRealloc() and HeapFree().
|
OnHandlesCreateheap() Create a heap using HeapCreate(). Do this first to enable the other tests. |
|
OnHandlesDestroyheap() Destroy the heap created above. |
|
OnHeapAllocatememory() Allocate 100 bytes on the heap |
|
OnHeapAllocateandreallocate() Allocate 100 bytes and then reallocate 200 bytes on the heap |
|
OnHeapAllocateanddelete() Allocate 100 bytes on the heap and deallocate it |
|
OnCreateHeapAllocateDestroy() Creates a heap, makes three allocations and destroys the heap. Allocations should not show as a leak. |
Allocation menu
Local submenu
...
Tests Win32 local heap functions LocalAlloc(), LocalRealloc() and LocalFree().
|
OnLocalAllocatememory() Allocate 4096 bytes using LocalAlloc(). |
|
OnLocalAllocateandreallocate() Allocates 4096 bytes and reallocates to 8192 bytes using LocalRealloc(). |
|
OnLocalAllocateanddelete() Allocates 4096 bytes and deallocates with LocalFree(). |
|
OnLocalAllocFunctions() Allocate and leak memory using indirect calls to LocalAlloc(), eg FormatMessage(). |
Allocation menu
Global submenu
...
Tests Win32 global heap functions GlobalAlloc(), GlobalRealloc() and GlobalFree().
|
OnGlobalAllocatememory() Allocate 4096 bytes using GlobalAlloc(). |
|
OnGlobalAllocateandreallocate() Allocates 4096 bytes and reallocates to 8192 bytes using GlobalRealloc(). |
|
OnGlobalAllocateanddelete() Allocates 4096 bytes and deallocates with GlobalFree(). |
Allocation menu
Virtual submenu
...
Tests Win32 virtual memory allocation functions VirtualAlloc(), and VirtualFree().
|
OnAllocationVirtualAllocate() Commit virtual memory using VirtualAlloc(). |
|
OnAllocationVirtualFree() Decommit virtual memory using VirtualFree(). |
Allocation menu
Virtual submenu
...
Tests Win32 virtual memory allocation functions VirtualAllocEx(), and VirtualFreeEx().
|
OnAllocationVirtualexAllocate() Commit virtual memory using VirtualAllocEx(). |
|
OnAllocationVirtualexFree() Decommit virtual memory using VirtualFreeEx(). |
|
OnMiscAllocations() Tests various functions including environment strings and array usage. Some allocations are leaked. |
|
OnNetApiAllocations() Tests various functions including api buffer use. Some allocations are leaked. |
|
OnTestPrinters() Opens and closes a printer and uses the printer notification api. Some allocations are leaked. |
|
Allocation menu
Local submenu
...
Tests Win32 COM functions CoTaskMemAlloc(), CoTaskMemRealloc() and CoTaskMemFree().
|
OnCotaskmemAllocatememory() Allocate 4000 bytes using CoTaskMemAlloc(). |
|
OnCotaskmemAllocateandreallocate() Allocates 4000 bytes and reallocates to 50000 bytes using CoTaskMemRealloc(). |
|
OnCotaskmemAllocateandreallocateandfree() Allocates 4000 bytes, reallocates to 50000 and deallocates with CoTaskMemFree(). |
|
OnCotaskmemAllocateanddelete() Allocate 4000 bytes, and deallocates with CoTaskMemFree(). |
Allocation menu
IMalloc (IMallocSpy)
...
Tests the Win32 OLE memory allocation spy functions via IMallocSpy.
All these functions use CoGetMalloc() to get the OLE allocator.
|
OnImallocAllocatememory() Allocate 4000 bytes using the OLE allocator. |
|
OnImallocAllocateandreallocate() Allocates 4000 bytes and reallocates to 50000 bytes. |
|
OnImallocAllocateandreallocateandfree() Allocates 4000 bytes, reallocates to 50000 and then deallocates it. |
|
OnImallocAllocateanddelete() Allocate 4000 bytes, and deallocates it. |
|
OnAllocationSysallocstring() Tests String use with SysAllocString(), SysReAllocString(), SysFreeString(), etc. Some allocations are leaked. |
|
OnAllocationCcomvarianttest() Tests BSTR allocations use with Variant*() functions. Some allocations are leaked. |
|
OnTestCoTaskMemFreeHooks() Tests various functions where memory is freed with CoTaskMemFree. |
|
OnAllocationSysallocstringspecialtest() Tests multiple allocations of zero length BSTRs. Allocations are leaked. |
|
OnAllocationAddrefreleasetest() Tests reference counting using AddRef() and Release() Allocations are leaked. |
|
OnAllocationAddrefreleasetestzerocount() As above but with additional attempt to Release() at a zero refcount. This may bring up the assertion dialog in the Debug versions |
Allocation menu
Custom Allocator submenu
...
Demonstrates use of a custom heap via the API for C++ and C.
These tests require a version of the example application linked to the Memory Validator Stub.
The Debug or Release Non Link configurations will disable these menu options.
|
OnCustomAllocatememory() Allocates memory using mvUserCustomAlloc() |
|
OnCustomAllocateandreallocate() Allocates and then reallocates using mvUserCustomReAlloc() |
|
OnCustomAllocateandreallocateandfree() Allocates, reallocates and frees using mvUserCustomFree() |
|
OnCustomAllocateanddelete() Allocates and frees memory |
|
OnAllocationCustomallocatorIncreasereferencecount() Demonstrates use of mvUserCustomRefCountIncrement() |
|
OnAllocationCustomallocatorDecreasereferencecount() Demonstrates use of mvUserCustomRefCountDecrement() |
|
OnMvCollectTRUE() Demonstrates use of mvSetCollect() |
|
OnMvCollectFALSE() Demonstrates use of mvSetCollect() |
|
OnAllocationDefinedallocator() Demonstrates use of #define to define a wrapper macro around a standard memory allocation function. The Coverage tab is able to handle such cases. |
|
OnTestManyHooks() A convenience test that includes a selection of the tests above and more! |