abort()

Torbjorn Granlund tg at gmplib.org
Mon Nov 8 18:28:27 CET 2010


Aaron Heckmann <aaron.heckmann at gmail.com> writes:

  What is the reasoning behind gmp using abort() when out of memory as opposed
  to throwing an exception?

Because GMP is written in C.  You can catch the signal caused by abort,
but how to do that is system dependent.

  I'm writing a binding for nodejs where aborting
  isn't an option. Are there any work arounds?
  
  gmp: overflow in mpz type
  Aborted

This is not an out-of-memory error, but really an overflow.  You're
attempting to compute a result that is more than 2^31 words.  This
behaviour cannot be changed with by using GMP's custom allocation (see
the manual).

-- 
Torbjörn


More information about the gmp-discuss mailing list