home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tricks of the Windows Gam…ming Gurus (2nd Edition)
/
Disc2.iso
/
vc98
/
crt
/
src
/
dbgdel.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1998-06-17
|
1KB
|
57 lines
/***
*dbgnew.cpp - defines C++ delete() routines, debug version
*
* Copyright (c) 1995-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines C++ delete() routines.
*
*******************************************************************************/
#ifdef _DEBUG
#include <cruntime.h>
#include <malloc.h>
#include <mtdll.h>
#include <dbgint.h>
/***
*void operator delete() - delete a block in the debug heap
*
*Purpose:
* Deletes any type of block.
*
*Entry:
* void *pUserData - pointer to a (user portion) of memory block in the
* debug heap
*
*Return:
* <void>
*
*******************************************************************************/
void operator delete(
void *pUserData
)
{
_CrtMemBlockHeader * pHead;
if (pUserData == NULL)
return;
_mlock(_HEAP_LOCK); /* block other threads */
/* get a pointer to memory block header */
pHead = pHdr(pUserData);
/* verify block type */
_ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse));
_free_dbg( pUserData, pHead->nBlockUse );
_munlock(_HEAP_LOCK); /* release other threads */
return;
}
#endif /* _DEBUG */