From deleteto reset, not all pointers to an object are on NULL. Also, you should not change the default fillable memory for DEBUG windows, and you should use some kind of thing, as boost::shared_ptr<>for pointers, anyway.
However, if you really want to shoot yourself in the foot , you can.
You can change the default padding for Windows DEBUG runtime using such a highlighting mechanism. This will only work with the selected HEAP object!
int main(int argc,char** arv)
{
_CrtSetAllocHook(&zero_fill);
malloc(100);
}
int zero_fill(int nAllocType,
void* pvData,
size_t nSize,
int nBlockUse,
long lRequest,
const unsigned char *szFileName,
int nLine )
{
if ( nBlockUse == _CRT_BLOCK )
return( TRUE );
switch(nAllocType)
{
case _HOOK_ALLOC:
case _HOOK_REALLOC:
memset(pvData,0,nSize);
break;
case _HOOK_FREE:
break;
}
return TRUE;
}
Ted source
share