Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jul 2006 20:49:32 +0200 (CEST)
From:      "P.U.Kruppa" <root@pukruppa.de>
To:        freebsd-questions@freebsd.org
Subject:   [OT] gcc: maximum length of an array?
Message-ID:  <20060724200535.G84312@www.pukruppa.net>

next in thread | raw e-mail | index | archive | help
Hi,

sorry for posting an [OT], but usually people on this list know 
everything :-)

Since I don't know too much about programming I am frequently 
fascinated by simple things like Eratosthenes' sieve.
As you might remember, one has to create a boolean array for 
that. The longer the array the more primes can be found.

With malloc() I can create an array of length 100000000 (10^8)
and the first 5761455 primes are calculated in a few seconds.
So of course I would like to test length 10^9 but here my program 
crashes.

So my questions:
 	- is there some way to create a longer array?
 	- or what are the alternatives?
 	- do you know some kind of fine manual about this?

Regards and thanks for all answers,

Uli.


*********************************************
* Peter Ulrich Kruppa - Wuppertal - Germany *
*********************************************



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060724200535.G84312>