首先来看最简单的new操作
int main()
{
int *temp = new int;
delete temp;
}
反汇编结果:调用了operator new
00311C9E push 4
00311CA0 call operator new (0311438h)
00311CA5 add esp,4
进入operator new中查看
void* __CRTDECL operator new(size_t const size)
{
00315320 push ebp
00315321 mov ebp,esp
00315323 push ecx
for (;;)
{
if (void* const block = malloc(size))
00315324 mov eax,dword ptr [size]
00315327 push eax
00315328 call _malloc (03111B3h)
0031532D add esp,4
00315330 mov dword ptr [ebp-4],eax
00315333 cmp dword ptr [ebp-4],0
00315337 je operator new+1Eh (031533Eh)
return block;
发现其底层也调用了malloc函数