From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31842 invoked by alias); 13 Jan 2005 17:39:31 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 31665 invoked from network); 13 Jan 2005 17:39:20 -0000 Received: from unknown (HELO masquerade.micron.com) (137.201.242.130) by sourceware.org with SMTP; 13 Jan 2005 17:39:20 -0000 Received: from mail-srv2.micron.com (localhost [127.0.0.1]) by masquerade.micron.com (8.12.9/8.12.2) with ESMTP id j0DHdXWo014490 for ; Thu, 13 Jan 2005 10:39:34 -0700 (MST) Received: from ntxboimbx07.micron.com (ntxboimbx07.micron.com [137.201.80.94]) by mail-srv2.micron.com (8.12.9/8.12.2) with ESMTP id j0DHdVet014471; Thu, 13 Jan 2005 10:39:32 -0700 (MST) From: lrtaylor@micron.com content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: memory problem Date: Thu, 13 Jan 2005 17:39:00 -0000 Message-ID: <363801FFD7B74240A329CEC3F7FE4CC403096643@ntxboimbx07.micron.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: To: , X-SW-Source: 2005-01/txt/msg00119.txt.bz2 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=20 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=3D/usr --mandir=3D/usr/share/man --infodir=3D/usr/share/info --enable-shared --enable-threads=3Dposix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=3Di386-redhat-linux Thread model: posix gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) 4) cat /proc/mtrr reg00: base=3D0x100000000 (4096MB), size=3D2048MB: write-back, count=3D1 reg01: base=3D0x180000000 (6144MB), size=3D1024MB: write-back, count=3D1 reg02: base=3D0x00000000 ( 0MB), size=3D2048MB: write-back, count=3D1 reg03: base=3D0x80000000 (2048MB), size=3D1024MB: write-back, count=3D1 reg04: base=3D0xbff80000 (3071MB), size=3D 512KB: uncachable, count=3D1 reg05: base=3D0xbff80000 (3071MB), size=3D 512KB: uncachable, count=3D1 reg06: base=3D0xc8000000 (3200MB), size=3D 128MB: write-combining, count=3D1 reg07: base=3D0xe0000000 (3584MB), size=3D 256MB: write-combining, count=3D1 _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/