AfxMemoryCheck Addition?
Hi,
I am having a problem with memory allocation a deletion. I am getting an
assert error in AFXMEM.CPP at line 370. Using MSVC for NT 1.1.
This indicates that the doublely linked list is mixed up. The previous pointer
for the current block is NULL, but the first block pointer doesn't point to
this block.
I would like to create my own version of AfxCheckMemory that keeps track of the
previous block and checks the previous pointer of each block. The only problem
is that I can't get access to pFirstBlock variable. I get an unresolved
reference using the following:
extern struct CBlockHeader* pFirstBlock;
I have also tried with "C".
Question 1: How can my routine get access to pFirstBlock that is defined in
AFXMEM.CPP?
Question 2: Should I instead modify AfxMemoryCheck and recompile MFC?
Question 3: Should this test be added by MS to MFC?
The code, untested, is as follows:
struct CBlockHeader* pPrev = NULL;
if (p->pBlockHeaderPrev != pPrev)
{
TRACE("Previous block error\n"; \\ Better error message needed
okay = FALSE;
}
pPrev = p;
Any suggestions?
Mark Skoglund
SandS Software