1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
m_dxMaterial = new D3DMATERIAL9(); <--
---------------------------------------------
void *__CRTDECL operator new(size_t size) _THROW1(_STD bad_alloc)
{ // try to allocate size bytes
void *p;
while ((p = malloc(size)) == 0) <--
if (_callnewh(size) == 0)
{ // report no memory
static const std::bad_alloc nomem;
_RAISE(nomem);
}
return (p);
}
----------------------------------------------
extern "C" _CRTIMP void * __cdecl malloc (
size_t nSize
)
{
void *res = _nh_malloc_dbg(nSize, _newmode, _NORMAL_BLOCK, NULL, 0); <--
RTCCALLBACK(_RTC_Allocate_hook, (res, nSize, 0));
return res;
}
--------------------------------------------------
extern "C" void * __cdecl _nh_malloc_dbg (
size_t nSize,
int nhFlag,
int nBlockUse,
const char * szFileName,
int nLine
)
{
void * pvBlk;
for (;;)
{
/* do the allocation
*/
pvBlk = _heap_alloc_dbg(nSize, nBlockUse, szFileName, nLine); <--
if (pvBlk)
{
return pvBlk;
}
if (nhFlag == 0)
{
errno = ENOMEM;
return pvBlk;
}
/* call installed new handler */
if (!_callnewh(nSize))
{
errno = ENOMEM;
return NULL;
}
/* new handler was successful -- try to allocate again */
}
}
-------------------------------------------------------------------------
// après on passe dans une grande fonction ou il fait plusieurs tests.
// Puis il récupère la taille de l'objet:
blockSize = _ROUND2(blockSize, _GRANULARITY);
// et il l'envoi à
pHead = (_CrtMemBlockHeader *)_heap_alloc_base(blockSize);
--------------------------------------------------------------------------
__forceinline void * __cdecl _heap_alloc (size_t size)
{
#ifndef _WIN64
void *pvReturn;
#endif /* _WIN64 */
if (_crtheap == 0) {
_FF_MSGBANNER(); /* write run-time error banner */
_NMSG_WRITE(_RT_CRT_NOTINIT); /* write message */
__crtExitProcess(255); /* normally _exit(255) */
}
#ifdef _WIN64
return HeapAlloc(_crtheap, 0, size ? size : 1);
#else /* _WIN64 */
if (__active_heap == __SYSTEM_HEAP) {
return HeapAlloc(_crtheap, 0, size ? size : 1); <--
} else
if ( __active_heap == __V6_HEAP ) {
if (pvReturn = V6_HeapAlloc(size)) {
return pvReturn;
}
}
#ifdef CRTDLL
else if ( __active_heap == __V5_HEAP )
{
if (pvReturn = V5_HeapAlloc(size)) {
return pvReturn;
}
}
#endif /* CRTDLL */
if (size == 0)
size = 1;
size = (size + BYTES_PER_PARA - 1) & ~(BYTES_PER_PARA - 1);
return HeapAlloc(_crtheap, 0, size);
#endif /* _WIN64 */
}
et HeapAlloc(_crtheap, 0, size ? size : 1); a renvoyé NULL. à partir de là ça remonte jusqu'à ma ligne "new" avec l'exception... |
Partager