public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: lrtaylor@micron.com
To: <dsdshgu@hotmail.com>, <gcc-help@gcc.gnu.org>
Subject: RE: memory problem
Date: Thu, 13 Jan 2005 17:39:00 -0000	[thread overview]
Message-ID: <363801FFD7B74240A329CEC3F7FE4CC403096643@ntxboimbx07.micron.com> (raw)

If you're allocating this array on the stack, then you're just running
into stack size problems.  The maximum stack size is limited by the OS,
and if your stack frame ends up larger than that, your program will
segfault like this.  Basically, you just need to increase your maximum
stack size, or allocate the array dynamically, which would probably be
preferable.

Run 'ulimit -s' to see what your stack size limit is set to (probably
something like 8 MB).  You can also use that command to change it
temporarily.

Thanks,
Lyle


-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of xuejun gu
Sent: Thursday, January 13, 2005 10:31 AM
To: gcc-help@gcc.gnu.org
Subject: memory problem

HI,

The machine I used have 6GB physical memory. However, when I run the c++

program I found the biggest array I can assign like

double A[10000][100]

I complied as:

$ gcc test1.cpp -o test1
$ ./test1'

When I increased the array size to double A[10000][120], it gave the 
message:
'Segmentation fault'


Is there any way to solve the problem?

Thanks!


here is the detail information of my machine:

1) cat /proc/meminfo

        total:    used:    free:  shared: buffers:  cached:
Mem:  6349705216 1669341184 4680364032        0 161710080 1048535040
Swap: 6547218432        0 6547218432
MemTotal:      6200884 kB
MemFree:       4570668 kB
MemShared:           0 kB
Buffers:        157920 kB
Cached:        1023960 kB
SwapCached:          0 kB
Active:         970660 kB
Inactive:       425152 kB
HighTotal:     5373376 kB
HighFree:      4126628 kB
LowTotal:       827508 kB
LowFree:        444040 kB
SwapTotal:     6393768 kB
SwapFree:      6393768 kB

2) cat /etc/redhat-release

Red Hat Linux release 9 (Shrike)

3) gcc  -v

Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

4) cat /proc/mtrr
reg00: base=0x100000000 (4096MB), size=2048MB: write-back, count=1
reg01: base=0x180000000 (6144MB), size=1024MB: write-back, count=1
reg02: base=0x00000000 (   0MB), size=2048MB: write-back, count=1
reg03: base=0x80000000 (2048MB), size=1024MB: write-back, count=1
reg04: base=0xbff80000 (3071MB), size= 512KB: uncachable, count=1
reg05: base=0xbff80000 (3071MB), size= 512KB: uncachable, count=1
reg06: base=0xc8000000 (3200MB), size= 128MB: write-combining,
count=1
reg07: base=0xe0000000 (3584MB), size= 256MB: write-combining,
count=1

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!

http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



             reply	other threads:[~2005-01-13 17:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-13 17:39 lrtaylor [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-11-09  4:59 Deepan
2006-11-09 13:32 ` Tim Prince
2005-01-13 17:32 xuejun gu
2005-01-13 17:39 ` Eljay Love-Jensen
     [not found] <20040913111103.77851.qmail@web52901.mail.yahoo.com>
2004-09-13 11:48 ` Ron Michael Khu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=363801FFD7B74240A329CEC3F7FE4CC403096643@ntxboimbx07.micron.com \
    --to=lrtaylor@micron.com \
    --cc=dsdshgu@hotmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).