[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using the GNU GMP Library for Bignums in Emacs

From: Paul Eggert
Subject: Re: Using the GNU GMP Library for Bignums in Emacs
Date: Mon, 9 Jul 2018 09:22:18 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

Tom Tromey wrote:
On the other hand, I see that Guile is using the mpz API.  So, maybe in
practice it is safe enough to just set custom allocation functions and
let them throw.

Guile treats memory allocation failure like stack overflow, in the sense that it relies on undefined behavior in both cases, I guess on the theory that it's typically better to try to keep running (with undefined behavior) than to give up and exit right away. GNU Emacs already takes a similar attitude toward stack overflow, so perhaps it could do the same for memory exhaustion within mpz routines. (Emacs could soften the blow by using a reserve, as I think it does already.)

With all that in mind, I guess it's OK to use the mpz API after all.

one idea would be to put mini-gmp.c into the Emacs source tree, but
only compile it if the real GMP library is not found.

That sounds like a good idea, given the above. We could also do this if the installed GMP library is too old for Emacs.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]