怪异问题 调试到位置(test dword ptr [eax],eax ; probe page.)局部数组变量定义所分配的最大空间为1M
来源:互联网 发布:淘宝申请退款客服介入 编辑:程序博客网 时间:2024/05/29 13:45
今天在写socket编程的时候,碰到一个很怪异的问题,调试程序的位置为:test dword ptr [eax],eax ; probe page.
这是什么问题呢?
经过查证才知道:
这跟局部数组变量定义所分配的最大空间设置大小有关。
局部变量的申请空间是存放于栈中,windows里默认栈内存是1M,所以当申请空间大于1M时就会出现溢出错误。
有两个程序A:#include "stdafx.h"int _tmain(int argc, _TCHAR* argv[]){int nArray[256000] = {0};nArray[1] = 5;printf("array 1 is %d",nArray[1]);return 0;}B:#include "stdafx.h"int _tmain(int argc, _TCHAR* argv[]){int nArray[260000] = {0};nArray[1] = 5;printf("array 1 is %d",nArray[1]);return 0;}
A可以正常运行,B虽然编译通过了,可是当运行时就会弹出错误。
所以解决此问题的方法就是扩大栈空间的大小
方法为
项目->属性->链接器->系统->堆栈保留大小
注:这里填的是字节数
如果你想把他扩大为2M的话,
1024*1024*2 = 2097152
然后再编译运行的话A,B就都可以通过了
- 怪异问题 调试到位置(test dword ptr [eax],eax ; probe page.)局部数组变量定义所分配的最大空间为1M
- 堆栈溢出问题 调试到位置(test dword ptr [eax],eax ; probe page.)局部数组变量定义所分配的最大空间为1M
- 堆栈溢出问题 调试到位置(test dword ptr [eax],eax ; probe page.)局部数组变量定义所分配的最大空间为1M
- 堆栈溢出问题 调试到位置(test dword ptr [eax],eax ; probe page.)
- test dword ptr [eax],eax ; probe page.
- test dword ptr [eax],eax ; probe page.
- test dword ptr [eax],eax ; probe page.
- test dword ptr [eax],eax ; probe page.
- test dword ptr [eax],eax ; probe page.
- test dword ptr [eax],eax ; probe page.调试中断解决方案
- 堆栈溢出问题 test dword ptr [eax],eax probe page.
- test dword ptr [eax],eax ; probe page.错误
- test dword ptr [eax],eax ; probe page.--VS报错!
- test dword ptr [eax],eax ; probe page. 分页出错
- 堆栈溢出问题 test dword ptr [eax],eax ; probe page错误
- TEST EAX,EAX问题
- C++ stack overflow 局部数组变量定义超过所分配的最大空间
- mov eax, dword ptr [esi]指令区别
- 同工科研究生谈谈如何做研究
- 编写netfilter模块 第三部分 Netfilter核心
- web前端获取JSON解决方案
- CSS样式02
- No window to dispatch pointer action 0
- 怪异问题 调试到位置(test dword ptr [eax],eax ; probe page.)局部数组变量定义所分配的最大空间为1M
- Redhat9 配置FTP
- 如何将String转成InputStream
- Linux内核模块传参
- 总结
- error LNK2001: unresolved external symbol "public: static ... 解决一法
- DOXYGEN简明实用教程
- onmouseover的想法
- 购物车代码