diff options
author | Andy Wingo <wingo@pobox.com> | 2021-04-26 22:26:31 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2021-04-26 22:27:22 +0200 |
commit | 534dd35a3c3e842d8547e83c38e5b67e99af89b5 (patch) | |
tree | 383b25f19aead3ca1dd9b34645fcda3f4e27e24f /libguile | |
parent | 04e9245918d3cfa985a4cf6b0850370d22eced04 (diff) | |
download | guile-534dd35a3c3e842d8547e83c38e5b67e99af89b5.tar.gz |
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.
Diffstat (limited to 'libguile')
-rw-r--r-- | libguile/numbers.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libguile/numbers.c b/libguile/numbers.c index 0aa18e59a..a4c8308f4 100644 --- a/libguile/numbers.c +++ b/libguile/numbers.c @@ -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, |