Dave's Brain

Browse - programming tips - borland check heap corrupt

Date: 2010apr21
Language: C/C++
Platform: Borland C++
Keywords: malloc, free

Q.  My heap is being corrupted somehow, how can I locate where?

A.  Sprinkle calls to heapcheck() around your code to narrow down the location.

Example from the help file:

	#include <malloc.h>

	if (heapcheck() == _HEAPCORRUPT)
		printf( "Heap is corrupted.\n" );
	else
		printf( "Heap is OK.\n" );


There is also a _heapchk() function.
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2010, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.