Thursday, July 20, 2006

Heap checking class

I found the idea of heap checking class in C User Journal of April 1991. The class is really useful and the following is my own implementation of heap checking class.

class HeapCheck
{
char* begin;
char* end;

public:
HeapCheck()
{
begin = new char;
delete begin;
}

bool IsOk()
{
bool ok;

end = new char;
ok = (end == begin);
delete end;

return ok;
}
}
;

No comments: