X-Spam-Check-By: sourceware.org Message-ID: <20060330135049.70352.qmail@web34801.mail.mud.yahoo.com> Date: Thu, 30 Mar 2006 05:50:49 -0800 (PST) From: Pete Subject: Re: segfault on memory intensive programs To: cygwin AT cygwin DOT com In-Reply-To: <20060330121802.GG20907@calimero.vinschen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --- Corinna Vinschen wrote: > On Mar 30 12:14, Dave Korn wrote: > > On 30 March 2006 12:08, Corinna Vinschen wrote: > > > > > > >>> #define N 600 // Matrix rank > > >>> // We multiply m1 and m2, and put the result > in m3. > > >>> int m1[N][N]; > > >>> int m2[N][N]; > > >>> int m3[N][N]; > > > > > No wonder. 600**3 * sizeof (int) * 3 == > 2592000000 ~= 2.4 Gigs. > > > > Those matrices are only 2d! > > Oh, hmm. 600**2 * sizeof (int) * 3 == 4320000 = 4.1 > Megs. > > Maybe reserving a stack bigger than 4Megs would > help, though? Hi Corinna, Thanks for looking at this! :) I've read the Cygwin FAQ for increasing stack and heap size, but it doesn't seem to be working. I allocated more than enough memory, so I assume my linker directives aren't having an effect. Example output: $ make g++ -W -Wall -O9 -funroll-loops -mtune=pentium4 -c -o matrix_mult_r.o matrix_mult_r.cc g++ -W -Wall -O9 -funroll-loops -mtune=pentium4 -c -o Timer.o Timer.cc g++ -o matrix_mult_r.exe *.o $ g++ -Wl,--heap,2048,--stack,8192 *.o -o matrix_mult_r.exe $ ./matrix_mult_r.exe Segmentation fault (core dumped) The Cygwin FAQ suggested a way of increasing the heap size using a registry setting. Is there a corresponding way to use the registry to increase the default stack size? Also, I actually DID set registry setting HKLM\SOFTWARE\Cygnus Solutions\Cygwin\heap_chunk_in_mb to be 4096. However, when I ran the test program given in the Cygwin FAQ: main() { unsigned int bit=0x40000000, sum=0; char *x; while (bit > 4096) { x = malloc(bit); if (x) sum += bit; bit >>= 1; } printf("%08x bytes (%.1fMb)\n", sum, sum/1024.0/1024.0); return 0; } It reports back 1536 MB. Very strange! The registry setting appears to not be having an effect. Thanks again, Pete __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/