From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8815 invoked by alias); 6 Dec 2001 15:35:14 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 8794 invoked from network); 6 Dec 2001 15:35:14 -0000 Received: from unknown (HELO barry.mail.mindspring.net) (207.69.200.25) by sources.redhat.com with SMTP; 6 Dec 2001 15:35:14 -0000 Received: from sdn-ar-004watacop282.dialsprint.net ([206.133.237.84] helo=tcprincemobl) by barry.mail.mindspring.net with smtp (Exim 3.33 #1) id 16C0YJ-0006TL-00; Thu, 06 Dec 2001 10:35:11 -0500 Message-ID: <015701c17e6b$9844f120$7add18ac@amr.corp.intel.com> From: "Tim Prince" To: "Jack Lloyd" , "Bansal, Shashank" Cc: References: Subject: Re: Query Date: Thu, 06 Dec 2001 07:44:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-SW-Source: 2001-12/txt/msg00284.txt.bz2 ----- Original Message ----- From: "Jack Lloyd" To: "Bansal, Shashank" Cc: Sent: Thursday, December 06, 2001 5:15 AM Subject: Re: Query > On Thu, 6 Dec 2001, Bansal, Shashank wrote: > > > Hi, > > > > I wished to create some large dimensional arrays in a program (6000x1000) > > and it fails to upload this memory (stack overflow). As soon as i reduce the > > dimension of arrays..it works perfectly. > > Most likely you have a limit in place that limits the size of your stack. > Assuming you're running on a Unix system, try running the command `ulimit > -s`; that will tell you how much stack space you can allocate. You may be > able to raise this limit. > > 6000x1000x4 (array of ints), is about 22 megabytes. I suppose it is > possible that some machines and/or operating systems will not let you use > this much stack space ever. > > > Could u help me out. I have tried this on different machines. > > Could you also tell if I could create virtual memory or somethign of that > > sort for the program. > > The best solution is probably to use the C malloc function or the C++ new > operator to create the memory, or use C++'s vector<> type. > > -Jack > Current stock linux distributions have a fixed 8MB stack limit. Not long ago it was 1MB. A scheme to adjust this, including ulimit, as Jack describes, and a re-configuration parameter, are sorely needed. In addition, compilers need a scheme such as the one planned for g95, where objects above a certain size (threshold set by a compiler option), are automatically put on the heap. Top quality Unix compilers have such a scheme. The current situation, where code has to be modified with explicit use of malloc() in order to port to linux from Unix or Windows, is unsatisfactory.