Subj : heapchecknode To : borland.public.cpp.borlandcpp From : Tom Date : Sun Jul 04 2004 03:34 pm Hello, In writting a program I created a wrapper to surround malloc/free for the debug versions, and I noticed borland's heapchecknode et al functions. So I used them, and they have saved me time debugging certain problems. However, I was doing some stuff involving large allocations and have come across a problem, which is best described by the folowing program: #include #include #include #include #include void testSize(int size) { void * tmp = malloc(size); printf("(%i) ",(int)tmp); int ret = heapchecknode(tmp); switch (ret) { case _USEDENTRY: printf("used entry (ok)\n"); break; case _HEAPCORRUPT: printf("heap corrupt\n"); break; case _BADNODE: printf("bad node\n"); break; case _BADVALUE: printf("bad value\n"); break; case _HEAPBADBEGIN: printf("heap bad begin\n"); break; case _HEAPBADNODE: printf("heap bad node\n"); break; case _HEAPBADPTR: printf("heap bad ptr\n"); break; } free(tmp); } int main() { for (int i=1022;i<1026;i++) { printf("%i: ",i); testSize(i*1024); } getch(); return 0; } I compiled it with the free BCC 5.5 compiler, using the simplest way possible: 'bcc32 main.cpp' The output is as follows: 1022: (8661496) used entry (ok) 1023: (8661496) used entry (ok) 1024: (12845060) bad node 1025: (12845060) bad node In other words, whilst these functions work fine for blocks under 1 meg, when equal in size or bigger than that they just don't appear to work. Anyone know why this is? Thanks for any help, Tom .