malloc和new
// L3.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <malloc.h>
int _tmain(int argc, _TCHAR* argv[])
{
//int *p;
//p = (int *)malloc(sizeof(int));
int *p;
p = new int;//按F11
delete p;
return 0;
}
进入到
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);
}