Lengthy arrays and SIGSEGV

Blake Huff stangmechanic at gmail.com
Sat Dec 17 18:53:11 CET 2005

Jim et al:

I'm not sure what you mean when you say "looping yourself" to init  
the array elements?   Additionally, I'm not entirely sure how I could  
allocate an array like this at run time- I'm not too keen when it  
comes to this sort of thing, do you have an example or psuedo code  
that would help?

Thanks for the response.


On Dec 17, 2005, at 8:34 AM, Jim White wrote:

>> However, the following code  with an
>> ARRAY_SIZE of 700000 fails, but works with 600000.
>> Changing the number of bits being allocated doesn't
>> seem to change the outcome.
> Have you tried looping yourself to init the array
> elements?
> Perhaps this isn't a GMP problem at all, rather the
> way your compiler/platform handles fixed-size arrays.
> The mpz_t structure itself is 4 words, or 16 bytes in
> 32-bit mode, so you are asking for an array of 10mb or
> so.
> On some systems a compiler might have a limit on the
> size of a fixed array so it can use more efficient
> short-reach addressing instructions.
> If this does apply, there may be a compiler option
> that lets you get around it (e.g. on Intel-compatible
> PC's there's a "memory model" option on most
> compilers).
> Alternatively you may need to allocate the array at
> runtime.
> Jim White
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at swox.com
> https://gmplib.org/mailman/listinfo/gmp-discuss

Blake Huff
stangmechanic at gmail.com

More information about the gmp-discuss mailing list