堆栈溢出问题 调试到位置(test dword ptr [eax],eax ; probe page.)局部数组变量定义所分配的最大空间为1M
来源:互联网 发布:手机模拟器网络加速器 编辑:程序博客网 时间:2024/06/07 20:07
堆栈溢出问题 调试到位置(test dword ptr [eax],eax ; probe page.)局部数组变量定义所分配的最大空间为1M
今天在写socket编程的时候,碰到一个很怪异的问题,调试程序的位置为:test dword ptr [eax],eax ; probe page.
这是什么问题呢?
经过查证才知道:
这跟局部数组变量定义所分配的最大空间设置大小有关。
局部变量的申请空间是存放于栈中,windows里默认栈内存是1M,所以当申请空间大于1M时就会出现溢出错误。
[cpp] view plaincopy
有两个程序
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就都可以通过了
0 0
- 堆栈溢出问题 调试到位置(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.错误
- test dword ptr [eax],eax ; probe page.--VS报错!
- test dword ptr [eax],eax ; probe page. 分页出错
- TEST EAX,EAX问题
- C++ stack overflow 局部数组变量定义超过所分配的最大空间
- mov eax, dword ptr [esi]指令区别
- webuploader上传文件,大小,类型,提示、和一些错误
- 从零开始学Makefile(九)
- 基于AlertDialog和Dialog封装的多种弹出框样式
- 高效加载大图片之Lrucache使用
- 更新ruby出现的Error running '__rvm_make -j 1',问题解决方法
- 堆栈溢出问题 调试到位置(test dword ptr [eax],eax ; probe page.)局部数组变量定义所分配的最大空间为1M
- java selenium (十二) 操作弹出窗口
- EDAS入门学习
- 51nod 2级算法题-1062
- OpenGL学习笔记2:绘制和混合
- tensorflow调参总结(不断更新中)
- Android--菜单的使用介绍
- git常用命令
- Spring Boot核心-基本配置