标签:
9: int *obj = new int(6); 00F714CE push 4 //压栈 00F714D0 call operator new (0F711EAh) //调用new函数返回分配的地址addr --- 0F711EAh是指令 jmp operator new 的地址 00F714D5 add esp,4 //恢复栈 00F714D8 mov dword ptr [ebp-0F8h],eax //把返回的地址addr赋给起始地址为ebp-0F8h的内存空间 00F714DE cmp dword ptr [ebp-0F8h],0 //判断分配是否成功 00F714E5 je main+51h (0F71501h) //如果不成功跳往0x0F71501h 00F714E7 mov eax,dword ptr [ebp-0F8h] //起始地址为ebp-0F8h 的内存空间(addr)赋值给eax 00F714ED mov dword ptr [eax],6 //把以起始地址为eax的内存空间(addr)置成6 00F714F3 mov ecx,dword ptr [ebp-0F8h] //起始地址为ebp-0F8h 的内存空间(addr)赋值给ecx 00F714F9 mov dword ptr [ebp-100h],ecx //ecx的值(addr)赋给起始地址为ebp-100h的内存空间 00F714FF jmp main+5Bh (0F7150Bh) //无条件跳转到0x0F7150B 00F71501 mov dword ptr [ebp-100h],0 //起始地址为ebp-100h的内存空间置为0---分配失败的情况 00F7150B mov edx,dword ptr [ebp-100h] //起始地址为ebp-100h的内存空间(addr)赋值给edx 00F71511 mov dword ptr [obj],edx //把edx的内容(addr)赋值给obj为起始地址的内存空间a 10: delete obj; 00F71514 mov eax,dword ptr [obj] //把obj为起始地址的内存空间送往eax 00F71517 mov dword ptr [ebp-0ECh],eax //eax送往以ebp-0ECh为起始地址的内存空间 00F7151D mov ecx,dword ptr [ebp-0ECh] //以ebp-0ECh为起始地址的内存空间送往ecx 00F71523 push ecx //ecx压栈 00F71524 call operator delete (0F710A0h) 00F71529 add esp,4 11:int *obj2 = new int(7); 与分配obj相同
标签:
原文地址:http://www.cnblogs.com/shouce/p/5176704.html