| \n |
| Microsoft Invisible Computing |
Debug heap, a wrapper for the system heap. Prepends/appends some check bytes to the actual data, to catch overruns and multi-free.
Implements IHeap
Determines which interfaces an object supports and returns a valid pointer to an interface.
Increments the reference count of the object.
Decrements the reference count of an object. When the count goes to zero, the object is destroyed.
Allocates a heap block of at least Size bytes from the given heap.
Changes the size of a previously allocated memory block.
Frees a block of memory previously allocated through a call to the IHeap.Alloc or IHeap.Realloc methods.
Returns the usable size of the memory block pointed by pMem, a block that was allocated out of the given heap. Returns 0 if error.
Validates the internal heap data structures. Checks the entire heap when pMem is NULL, otherwise verifies that the specified memory block is valid.
Allocates memory at a specific address, from the given heap.
Returns status information about this heap
Create a new heap instance, either through allocating memory from this or from implementation specific resources.
This heap implements a wrapper for the system heap (obtained through a call to CurrentHeap()). All calls are passed through, therefore the actual memory comes from the same place as before. The header/trailer will impose an overhead of at least 16 bytes to each memory allocation.
The implementation of the constructor overrides the CurrentHeap function, when it is called the first time. This means that CurrentHeap will henceforth return that same first heap, until it is destroyed. Further calls to the constructor will create nested debug heaps, which is probably an unnecessary overkill.
Internally, the heap maintains a few statistical counters that might be of interest to a developer. The number of calls to each method are recorded for instance. These counters can be looked at with a debugger.
You need to call CreateDebugHeap() immediately in your program, before anything gets allocated. For C++ this probably means that you need to wrap your actual main with something like this:
main()
{
PIHEAP Heap = CreateDebugHeap(0,max heap size,0);
int i = my_real_main(0,NULL);
Heap->Release();
return i;
}
| ©2006 Microsoft Corporation. All rights reserved. | Terms of Use | Privacy Statement | Accessibility | End User License Agreement |