
| View previous topic :: View next topic |
| Author |
Message |
Carlos Alberto Bulant Posted via mailing list.
|
Posted: Mon Oct 12, 2009 7:25 pm Post subject: array size |
|
|
Hi all,
i'm using cygwin in my c++ netbeans project.
i'm using widows xp sp3 32bits + netbeans 6.7.1 + cygwin
i need to use big float arrays, but i can't make it run. the
compilation is succesfull, but when i run, even a simple code like
this:
//-----------------------------------------------------------
int main(int argc, char** argv) {
int n = 729000;
float x2[n];
for (int i = 0; i < n ; ++i) {
printf("%f - ", x2[i]);
}
return (EXIT_SUCCESS);
}
//----
crash, showing this error on the console:
//----
5 [main] mixcf 12792 _cygtls::handle_exceptions: Error while dumping
state (probably corrupted stack)
/cygdrive/d/develop/NetBeans
6.7.1/dlight1/bin/nativeexecution/dorun.sh: line 51: 12792
segmentation fault (core dumped) /bin/sh "${PIDFILE}.sh"
//----
and this file is created:
//----
Exception: STATUS_STACK_OVERFLOW at eip=0040136F
eax=000CEEB0 ebx=00000000 ecx=00032CB0 edx=61102EDC esi=611021A0 edi=0040160C
ebp=0022CCE8 esp=0022CCA8
program=d:\carlitos\Develop\NetBeans-Projects\C,C++,FORTRAN-tests\MixCF\dist\Debug\Cygwin-Windows\mixcf.exe,
pid 12792, thread main
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame Function Args
0022CCE8 0040136F (00000001, 6116C310, 00670090, 0022CC70)
0022CD98 610060D8 (00000000, 0022CDD0, 61005450, 0022CDD0)
61005450 61004416 (0000009C, A02404C7, E8611021, FFFFFF48)
5 [main] mixcf 12792 _cygtls::handle_exceptions: Error while
dumping state (probably corrupted stack)
//----
i hope you can tellme what can i do to solve this, because i need to
work with much bigger arrays...
thanks in advance
carlitos
PD: sorry for my inglish, i'm from argentina, we speak spanish... |
|
| Back to top |
|
 |
Lorin Netsch Posted via mailing list.
|
Posted: Mon Oct 12, 2009 7:38 pm Post subject: array size |
|
|
Carlos,
Large arrays like this are better allocated on the heap. Could you try
using "new" and see if that works?
Regards,
Lorin Netsch
-----Original Message-----
From: Carlos Alberto Bulant [mailto:address-removed]
Sent: Monday, October 12, 2009 2:26 PM
To: address-removed
Subject: array size
Hi all,
i'm using cygwin in my c++ netbeans project.
i'm using widows xp sp3 32bits + netbeans 6.7.1 + cygwin
i need to use big float arrays, but i can't make it run. the
compilation is succesfull, but when i run, even a simple code like
this:
//-----------------------------------------------------------
int main(int argc, char** argv) {
int n = 729000;
float x2[n];
for (int i = 0; i < n ; ++i) {
printf("%f - ", x2[i]);
}
return (EXIT_SUCCESS);
}
//----
crash, showing this error on the console:
//----
5 [main] mixcf 12792 _cygtls::handle_exceptions: Error while dumping
state (probably corrupted stack)
/cygdrive/d/develop/NetBeans
6.7.1/dlight1/bin/nativeexecution/dorun.sh: line 51: 12792
segmentation fault (core dumped) /bin/sh "${PIDFILE}.sh"
//----
and this file is created:
//----
Exception: STATUS_STACK_OVERFLOW at eip=0040136F
eax=000CEEB0 ebx=00000000 ecx=00032CB0 edx=61102EDC esi=611021A0
edi=0040160C
ebp=0022CCE8 esp=0022CCA8
program=d:\carlitos\Develop\NetBeans-Projects\C,C++,FORTRAN-tests\MixCF\dist
\Debug\Cygwin-Windows\mixcf.exe,
pid 12792, thread main
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame Function Args
0022CCE8 0040136F (00000001, 6116C310, 00670090, 0022CC70)
0022CD98 610060D8 (00000000, 0022CDD0, 61005450, 0022CDD0)
61005450 61004416 (0000009C, A02404C7, E8611021, FFFFFF48)
5 [main] mixcf 12792 _cygtls::handle_exceptions: Error while
dumping state (probably corrupted stack)
//----
i hope you can tellme what can i do to solve this, because i need to
work with much bigger arrays...
thanks in advance
carlitos
PD: sorry for my inglish, i'm from argentina, we speak spanish... |
|
| Back to top |
|
 |
Lorin Netsch Posted via mailing list.
|
Posted: Mon Oct 12, 2009 7:38 pm Post subject: array size |
|
|
Carlos,
Large arrays like this are better allocated on the heap. Could you try
using "new" and see if that works?
Regards,
Lorin Netsch
-----Original Message-----
From: Carlos Alberto Bulant [mailto:address-removed]
Sent: Monday, October 12, 2009 2:26 PM
To: address-removed
Subject: array size
Hi all,
i'm using cygwin in my c++ netbeans project.
i'm using widows xp sp3 32bits + netbeans 6.7.1 + cygwin
i need to use big float arrays, but i can't make it run. the
compilation is succesfull, but when i run, even a simple code like
this:
//-----------------------------------------------------------
int main(int argc, char** argv) {
int n = 729000;
float x2[n];
for (int i = 0; i < n ; ++i) {
printf("%f - ", x2[i]);
}
return (EXIT_SUCCESS);
}
//----
crash, showing this error on the console:
//----
5 [main] mixcf 12792 _cygtls::handle_exceptions: Error while dumping
state (probably corrupted stack)
/cygdrive/d/develop/NetBeans
6.7.1/dlight1/bin/nativeexecution/dorun.sh: line 51: 12792
segmentation fault (core dumped) /bin/sh "${PIDFILE}.sh"
//----
and this file is created:
//----
Exception: STATUS_STACK_OVERFLOW at eip=0040136F
eax=000CEEB0 ebx=00000000 ecx=00032CB0 edx=61102EDC esi=611021A0
edi=0040160C
ebp=0022CCE8 esp=0022CCA8
program=d:\carlitos\Develop\NetBeans-Projects\C,C++,FORTRAN-tests\MixCF\dist
\Debug\Cygwin-Windows\mixcf.exe,
pid 12792, thread main
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame Function Args
0022CCE8 0040136F (00000001, 6116C310, 00670090, 0022CC70)
0022CD98 610060D8 (00000000, 0022CDD0, 61005450, 0022CDD0)
61005450 61004416 (0000009C, A02404C7, E8611021, FFFFFF48)
5 [main] mixcf 12792 _cygtls::handle_exceptions: Error while
dumping state (probably corrupted stack)
//----
i hope you can tellme what can i do to solve this, because i need to
work with much bigger arrays...
thanks in advance
carlitos
PD: sorry for my inglish, i'm from argentina, we speak spanish... |
|
| Back to top |
|
 |
Valeriy Soldatov Posted via mailing list.
|
Posted: Mon Oct 12, 2009 7:45 pm Post subject: array size |
|
|
1) You can add "-Wl,--stack,16777216" into Linker|Additional Options field
2) rewrite code
| Quote: | Hi all,
i'm using cygwin in my c++ netbeans project.
i'm using widows xp sp3 32bits + netbeans 6.7.1 + cygwin
i need to use big float arrays, but i can't make it run. the
compilation is succesfull, but when i run, even a simple code like
this:
//-----------------------------------------------------------
int main(int argc, char** argv) {
int n = 729000;
float x2[n];
for (int i = 0; i < n ; ++i) {
printf("%f - ", x2[i]);
}
return (EXIT_SUCCESS);
}
//----
crash, showing this error on the console:
//----
5 [main] mixcf 12792 _cygtls::handle_exceptions: Error while dumping
state (probably corrupted stack)
/cygdrive/d/develop/NetBeans
6.7.1/dlight1/bin/nativeexecution/dorun.sh: line 51: 12792
segmentation fault (core dumped) /bin/sh "${PIDFILE}.sh"
//----
and this file is created:
//----
Exception: STATUS_STACK_OVERFLOW at eip=0040136F
eax=000CEEB0 ebx=00000000 ecx=00032CB0 edx=61102EDC esi=611021A0 edi=0040160C
ebp=0022CCE8 esp=0022CCA8
program=d:\carlitos\Develop\NetBeans-Projects\C,C++,FORTRAN-tests\MixCF\dist\Debug\Cygwin-Windows\mixcf.exe,
pid 12792, thread main
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame Function Args
0022CCE8 0040136F (00000001, 6116C310, 00670090, 0022CC70)
0022CD98 610060D8 (00000000, 0022CDD0, 61005450, 0022CDD0)
61005450 61004416 (0000009C, A02404C7, E8611021, FFFFFF48)
5 [main] mixcf 12792 _cygtls::handle_exceptions: Error while
dumping state (probably corrupted stack)
//----
i hope you can tellme what can i do to solve this, because i need to
work with much bigger arrays...
thanks in advance
carlitos
PD: sorry for my inglish, i'm from argentina, we speak spanish...
|
|
|
| Back to top |
|
 |
Carlos Alberto Bulant Posted via mailing list.
|
Posted: Tue Oct 13, 2009 2:47 am Post subject: array size |
|
|
Hi, thanks for answering...
i try adding "-Wl,--stack,16777216" into Linker|Additional Options
field, and it works, i would like to know what do the parameters
mean...
respect using the heap (new), i belive it's not a posibility, because
i need multidimensional arrays (5 dimensions):
float A[X][Y][Z][dim4][dim5]
and the A array has to be passed to a FORTRAN subroutine for a heavy
number crushing algorithm, and i need all its element to be allocated
contiguosly in memory, i think that if i create A dinamicaly in the
heap using the new opertator, the elements will not be together, am i
wright?
any other sugestions?
which is the maximum number of elements that i can allocate in A??
thanks in advance
2009/10/12 Valeriy Soldatov <address-removed>:
| Quote: | 1) You can add "-Wl,--stack,16777216" into Linker|Additional Options field
2) rewrite code
| Quote: |
Hi all,
i'm using cygwin in my c++ netbeans project.
i'm using widows xp sp3 32bits + netbeans 6.7.1 + cygwin
i need to use big float arrays, but i can't make it run. the
compilation is succesfull, but when i run, even a simple code like
this:
//-----------------------------------------------------------
int main(int argc, char** argv) {
|
|
| Back to top |
|
 |
Valeriy Soldatov Posted via mailing list.
|
Posted: Tue Oct 13, 2009 6:43 am Post subject: array size |
|
|
From http://www.cygwin.com/ml/cygwin/1998-09/msg00120.html:
| Quote: | | Quote: | How do I increase the stack size for a program built
with cygwin b19, on NT?
|
`ld --stack=<STACK_SIZE>' or `gcc -Wl,--stack=<STACK_SIZE>' should do the
job, where STACK_SIZE is some number eg., 0x2300000.
`ld --help' is a good place to look.
|
BTW, default stack size for cygwin or mingw compiled applications is 32M.
| Quote: | Hi, thanks for answering...
i try adding "-Wl,--stack,16777216" into Linker|Additional Options
field, and it works, i would like to know what do the parameters
mean...
|
|
|
| Back to top |
|
 |
Labhrainn Aemilianus
Joined: 07 Nov 2009 Posts: 2
|
Posted: Sat Nov 07, 2009 10:58 am Post subject: array size |
|
|
When you refer to the size of an object or variable in the strictest sense, you are talking about how much memory it takes up. C++ will tell you how much memory something takes in bytes (Remember, a byte is 8 bits, with bits being either a binary 0 or 1). To figure out the size of something simply use this syntax:
sizeof(variable)
For instance, you could do this:
#include <iostream>
using namespace std;
int main()
{
cout << "sizeof(char) = " << sizeof(char) << endl;
cout << "sizeof(short) = " << sizeof(short) << endl;
cout << "sizeof(int) = " << sizeof(int) << endl;
// and so on . . .
} _________________ PSD to HTML Conversion |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|
|
|
|
| |