Microsoft KB Archive/32442

{|
 * width="100%"|

_heapchk Performs Consistency Check on Heap

 * }

Q32442

5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a | 1.00 1.50 MS-DOS | OS/2 | WINDOWS kbprg -- The information in this article applies to: - The C Run-time (CRT), included with: - Microsoft C for MS-DOS, versions 5.1, 6.0, 6.0a, and 6.0ax - Microsoft C for OS/2, versions 5.1, 6.0, and 6.0a - Microsoft C/C++ for MS-DOS, version 7.0 - Microsoft Visual C++ for Windows, versions 1.0 and 1.5 -- SUMMARY ======= The _heapchk routine performs a consistency check on the heap by examining the header information of the memory blocks in the heap; it cannot, however, detect corruption of data within the heap's nodes. The _heapchk routine can only detect corruption of the heap's header information. The _heapchk routine checks for the following: - It checks to see if any heap has been allocated. If not, _heapchk returns _HEAPEMPTY. - It checks the beginning of the heap block to see if the first allocation block has been corrupted; if so, it returns _HEAPBADBEGIN. (Note that only the header information is checked.) - It scans through the far heap block, moving from node to node. For each node, it checks the header information to make sure it has not been corrupted; if so, _heapchk returns _HEAPBADNODE. Note that the only kind of corruption _heapchk can detect is an out-of- bounds value in the header; it cannot detect corrupted data within the heap block itself. If the fill value passed is not _HEAPSET_NOFILL, and the block is unallocated, _heapchk fills memory with the fill value. - If _heapchk makes it all the way through the heap (that is, it checks the headers for all nodes), it returns _HEAPOK. MORE INFORMATION ================ Microsoft C versions 6.0 and later also provide the _heapwalk functions, which can aid in debugging memory allocation problems. More information on the _heapwalk function may be found in the online help provided with Microsoft C version 6.0 and later. Additional reference words: kbinf 1.00 1.50 6.00a 6.0ax 6.00ax 7.00 KBCategory: kbprg KBSubcategory: CRTIss

Keywords : kb16bitonly

Issue type :

Technology : kbVCsearch kbAudDeveloper kbCRT