由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Computation版 - 是不是cygwin问题?
相关主题
fortran memory problemfortran还是matlab?
Write In Clet me ask a question again
详细介绍Fortran 77的站点高手教教怎么在fortran里头call c++的function阿?
GSL里面的例子是不是有的不对阿?what is wrong with my matlab?
matlab能管理多大的内存?>1G有没有什么积分的快速算法
a C language question regarding pointer usage问个问题, 用msiexec 去 uninstall 一个.msi 文件和直接到add/remove program里去有什么不同
请教个问题求助:怎样运行Maxima?
帮忙看看这个看似简单的问题万能的水版,谁能帮我解决 100% disk use 的问题 (转载)
相关话题的讨论汇总
话题: cygwin话题: size话题: stack话题: memory话题: use
进入Computation版参与讨论
1 (共1页)
s**b
发帖数: 169
1
cygwin下,运行a.out,显示segmentation fault, (core dumped),
possibly due to stack overflow(underflow?).
最大的数组 double 20000*16。其他的可以忽略不计。
winxp, 1.5G
c*******e
发帖数: 8624
2
unlikely

【在 s**b 的大作中提到】
: cygwin下,运行a.out,显示segmentation fault, (core dumped),
: possibly due to stack overflow(underflow?).
: 最大的数组 double 20000*16。其他的可以忽略不计。
: winxp, 1.5G

s**b
发帖数: 169
3
那是不是cygwin对这个支持不太好?

【在 c*******e 的大作中提到】
: unlikely
e***e
发帖数: 3872
4
数组是局部变量?

【在 s**b 的大作中提到】
: cygwin下,运行a.out,显示segmentation fault, (core dumped),
: possibly due to stack overflow(underflow?).
: 最大的数组 double 20000*16。其他的可以忽略不计。
: winxp, 1.5G

s**b
发帖数: 169
5
全局变量

【在 e***e 的大作中提到】
: 数组是局部变量?
e***e
发帖数: 3872
6
如果程序只有这个大的数组,当然有些简单访问,比如遍历累计之类的,
编译运行都没问题。

【在 s**b 的大作中提到】
: 全局变量
s**b
发帖数: 169
7
没看懂你说得和我问得有什么联系?

【在 e***e 的大作中提到】
: 如果程序只有这个大的数组,当然有些简单访问,比如遍历累计之类的,
: 编译运行都没问题。

f*******a
发帖数: 80
8
how do you allocate memory for the data? It is not a limitation of CYGWIN.
If you are using malloc in C, notice there is a default stack size for each
program. You cannot claim for a size greater than the default size by
specifying a flag in gcc, which allows you to specify the stack size. Check
gcc manual.
However, I recommand to use the data structure "vector" in C++ and use g++.
vector gives the freedom for dynamic memory allocation.

【在 s**b 的大作中提到】
: cygwin下,运行a.out,显示segmentation fault, (core dumped),
: possibly due to stack overflow(underflow?).
: 最大的数组 double 20000*16。其他的可以忽略不计。
: winxp, 1.5G

s**b
发帖数: 169
9
I just use an array x[size][size], where size is some big number, but
should not exceed my physical memory. The same code cna run under linux
without any problem.

each
Check
.

【在 f*******a 的大作中提到】
: how do you allocate memory for the data? It is not a limitation of CYGWIN.
: If you are using malloc in C, notice there is a default stack size for each
: program. You cannot claim for a size greater than the default size by
: specifying a flag in gcc, which allows you to specify the stack size. Check
: gcc manual.
: However, I recommand to use the data structure "vector" in C++ and use g++.
: vector gives the freedom for dynamic memory allocation.

f*******a
发帖数: 80
10
You solution is not sufficient. For instance, if your machine has 1G of
memory, the OS will not allow you to use all of them.
when you run a program, a stack with a finite size is created automatically.
if x[size][size] exceeds this default size of the stack, you will receive
the notorious segmentation fault. (This default stack size might vary among
platforms, which explains why your code runs in linux.) One way to work
around this problem is to specify a flag to gcc when you compile the proble
相关主题
a C language question regarding pointer usagefortran还是matlab?
请教个问题let me ask a question again
帮忙看看这个看似简单的问题高手教教怎么在fortran里头call c++的function阿?
进入Computation版参与讨论
s**b
发帖数: 169
11
under cygwin, i try to set stacksize, but it always says
something like stacksize cannot be changed.
I have uninstalled cygwin, so I cannnot re-run the code.

automatically.
among
problem

【在 f*******a 的大作中提到】
: You solution is not sufficient. For instance, if your machine has 1G of
: memory, the OS will not allow you to use all of them.
: when you run a program, a stack with a finite size is created automatically.
: if x[size][size] exceeds this default size of the stack, you will receive
: the notorious segmentation fault. (This default stack size might vary among
: platforms, which explains why your code runs in linux.) One way to work
: around this problem is to specify a flag to gcc when you compile the proble

f*******a
发帖数: 80
12
i used
g++ -Wl,--stack,10000000 -g funnyhaha.cpp
s**b
发帖数: 169
13
i use similar parameters and have the mentioned error.
I can only change stacksize in a range, ohterwise it will give
some kind of warning by cygwin.
not sure the detail.

【在 f*******a 的大作中提到】
: i used
: g++ -Wl,--stack,10000000 -g funnyhaha.cpp

f*******a
发帖数: 80
14
you cannot allocate all the memory by this static memory allocation. Use
malloc() for dynamic memory allocation. This will give you much more space
than what you can achieve with specifying stack size.

【在 s**b 的大作中提到】
: i use similar parameters and have the mentioned error.
: I can only change stacksize in a range, ohterwise it will give
: some kind of warning by cygwin.
: not sure the detail.

s**b
发帖数: 169
15
you mean in the code?
anyway, it can run under linux but not cygwin,
so i want to know if there is anyway to correct this problem.

【在 f*******a 的大作中提到】
: you cannot allocate all the memory by this static memory allocation. Use
: malloc() for dynamic memory allocation. This will give you much more space
: than what you can achieve with specifying stack size.

1 (共1页)
进入Computation版参与讨论
相关主题
万能的水版,谁能帮我解决 100% disk use 的问题 (转载)matlab能管理多大的内存?>1G
Char x[] = "abc"; 是在heap还是stack上? (转载)a C language question regarding pointer usage
A problem about Heap and Stack.请教个问题
static variable存在heap还是stack?帮忙看看这个看似简单的问题
fortran memory problemfortran还是matlab?
Write In Clet me ask a question again
详细介绍Fortran 77的站点高手教教怎么在fortran里头call c++的function阿?
GSL里面的例子是不是有的不对阿?what is wrong with my matlab?
相关话题的讨论汇总
话题: cygwin话题: size话题: stack话题: memory话题: use