public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Eliot Moss <moss@cs.umass.edu>
To: cygwin@cygwin.com
Subject: Re: My C arrays are too large
Date: Fri, 13 Sep 2019 12:37:00 -0000	[thread overview]
Message-ID: <870fc8d4-4816-26b1-0b1f-3ed0aaa456f0@cs.umass.edu> (raw)
In-Reply-To: <CY4PR1101MB21339312E8F5656D8C887BFE81B30@CY4PR1101MB2133.namprd11.prod.outlook.com>

On 9/13/2019 8:10 AM, Blair, Charles E III wrote:
> My apologies for failing to reply on-list.  I don't know how :(
> 
> My machine is 64 bit, and I hope I installed the correct version of cygwin.
> 
> This program:
> 
> #include<stdio.h>
> int main(){char *a[50][8192];
> return 0;}
> 
> compiles with gcc  (no special options) but gives "Segmentation fault".

Ah, it's a local variable, which means it's going on your stack.
Have you set a stack size limit that's large enough?  On my system
ulimit -a will report all the limits, and ulimit -s can be used to
set the stack limit.

In my 64-bit cygwin, ulimit -a reports a stack size of 2032 K bytes.
Your structure will be 50 * 8K * 8 = 3200 K bytes.  So if your setup
is similar to mine, your tack isn't big enough.  If you declared the
array outside of main so that it is global and in the bss area, if
would probably work out of the box, but adjusting your stack size
should fix your problem, I believe.

Regards - EM

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  reply	other threads:[~2019-09-13 12:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13 12:18 Blair, Charles E III
2019-09-13 12:37 ` Eliot Moss [this message]
2019-09-13 18:44 ` Achim Gratz
2019-09-13 18:50   ` Eliot Moss
2019-09-13 19:01   ` Jose Isaias Cabrera
2019-09-14  5:32     ` Lee
2019-09-18 19:09     ` Joel Rees
2019-09-18 20:40       ` Jose Isaias Cabrera
2019-09-18 20:46         ` Eliot Moss
2019-09-19  1:19         ` Joel Rees
2019-09-19 18:04           ` Jose Isaias Cabrera
2019-09-19 21:58         ` Brian Inglis
2019-09-13 13:44 my " Blair, Charles E III
2019-09-13 14:20 ` Eliot Moss

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=870fc8d4-4816-26b1-0b1f-3ed0aaa456f0@cs.umass.edu \
    --to=moss@cs.umass.edu \
    --cc=cygwin@cygwin.com \
    /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).