1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 01:00:20 +02:00

Allow users to force gmp to use libgc

* doc/ref/guile-invoke.texi (Environment Variables): Document
GUILE_INSTALL_GMP_MEMORY_FUNCTIONS.
* libguile/numbers.c (scm_init_numbers): Use environment variable.
This commit is contained in:
Andy Wingo 2021-04-26 22:26:31 +02:00
parent 04e9245918
commit 534dd35a3c
2 changed files with 22 additions and 0 deletions

View file

@ -10412,6 +10412,15 @@ SCM_PRIMITIVE_GENERIC (scm_sqrt, "sqrt", 1, 0, 0,
void
scm_init_numbers ()
{
/* Give the user the chance to force the use of libgc to manage gmp
digits, if we know there are no external GMP users in this process.
Can be an important optimization for those who link external GMP,
before we switch to the MPN API. */
if (!SCM_ENABLE_MINI_GMP)
scm_install_gmp_memory_functions
= scm_getenv_int ("GUILE_INSTALL_GMP_MEMORY_FUNCTIONS",
scm_install_gmp_memory_functions);
if (scm_install_gmp_memory_functions)
mp_set_memory_functions (custom_gmp_malloc,
custom_gmp_realloc,