My arrays in C are too large

Eliot Moss moss@cs.umass.edu
Fri Sep 13 12:10:00 GMT 2019


On 9/13/2019 7:04 AM, Blair, Charles E III wrote:
> I have been using on other machines a program that includes
> 
> char *a[50][8192];
> 
> but this declaration, by itself, gives "segmentation" errors.
> 
> [8192 is BUFSIZ on other machines, although it seems to be 1024 here.
> The program uses 50 different permutations on strings of size BUFSIZ.]

It's surprising to me, since that is 50 * 8192 = 400K char * pointers,
which is likely 1600K bytes (assuming a 32-bit machine).  Not tiny,
but well within the scope of modern machines.  The strings themselves
are what will take a lot of space, unless a lot of the pointers are
NULL or something.  There would seem to be something else going on.
Can you reduce this to the smallest failing example?

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



More information about the Cygwin mailing list