Segmentation fault

E

eenna

Hello there,
I've a question regarding segmentation fault.
When I run my C++ code on SUN Workshop 6 under UNIX Solaris 8, it compiles
correctly, but after execution it gives a segmentation fault!
The program includes declaration of a huge multidimensional array which has
a variable size for each iteration. The matrix takes its size after
execution and this size can be as high as (50,000 x 50,000).
Is the segmentation error related to the size of this matrix? If so is there
any limitations on the memory allocation in SUN Workshop 6 or Unix Solaris
8 (with 1GB RAM memory)?
Thanks.
 
A

Aggro

eenna said:
Hello there,
I've a question regarding segmentation fault.
When I run my C++ code on SUN Workshop 6 under UNIX Solaris 8, it compiles
correctly, but after execution it gives a segmentation fault!
The program includes declaration of a huge multidimensional array which has
a variable size for each iteration. The matrix takes its size after
execution and this size can be as high as (50,000 x 50,000).
Is the segmentation error related to the size of this matrix? If so is there
any limitations on the memory allocation in SUN Workshop 6 or Unix Solaris
8 (with 1GB RAM memory)?
Thanks.

Small code example please? Also note that this group is for standard C++
questions only. If your problem depends on the environment, it is not
topical here. But you can post the small, compilable code example, and
let's see if there is anything wrong with it.
 
K

klaus hoffmann

eenna said:
Hello there,
I've a question regarding segmentation fault.
When I run my C++ code on SUN Workshop 6 under UNIX Solaris 8, it compiles
correctly, but after execution it gives a segmentation fault!
The program includes declaration of a huge multidimensional array which has
a variable size for each iteration. The matrix takes its size after
execution and this size can be as high as (50,000 x 50,000).

It depends on the element size. 50,000 x 50,000 is 250 M, which is roughly 250
MBytes with chars or 1 GByte with 4-byte floats or ints. 1 such array my fit in
your virtual memory. If you have 8-byte floats (double) then you need approx. 2
Gbytes and that may exceed the architectural limits of a 32-Bit machine (don't
know whether your Sun is 64 bit)
hth
Klaus
 
H

Howard

klaus hoffmann said:
It depends on the element size. 50,000 x 50,000 is 250 M, which is roughly 250
MBytes with chars or 1 GByte with 4-byte floats or ints. 1 such array my fit in
your virtual memory. If you have 8-byte floats (double) then you need approx. 2
Gbytes and that may exceed the architectural limits of a 32-Bit machine (don't
know whether your Sun is 64 bit)
hth
Klaus

Ahem....calculator, please. Let's see...50,000 * 50,000....looks like
2,500,000,000 to me. That's 2.5 billion (or just under 2.4Gb), not 250
million. And that's just the item count. It's just too big.

-Howard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top