mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
install gmp memory functions that let libgc know about allocations
* libguile/numbers.c (custom_gmp_malloc, custom_gmp_realloc, custom_gmp_free): New static functions used by GMP for allocation. These are just wrappers for scm_malloc, scm_realloc, and free. (scm_init_numbers): If scm_install_gmp_memory_functions is nonzero, use mp_set_memory_functions to configure GMP to use custom_gmp_{malloc,realloc,free} for memory allocation. (scm_bigprint): Ask gmp for the function used to deallocate the string returned by mpz_get_str. * libguile/numbers.h: Declare scm_install_gmp_memory_functions. * libguile/guile.c: When running the Guile binary, install the gmp_memory_functions. Based on a patch by Mark H Weaver <mhw@netris.org>.
This commit is contained in:
parent
738c899e4c
commit
b57bf2724a
3 changed files with 45 additions and 3 deletions
|
@ -520,6 +520,9 @@ SCM_API double scm_c_angle (SCM z);
|
|||
|
||||
SCM_API int scm_is_number (SCM val);
|
||||
|
||||
/* If nonzero, tell gmp to use GC_malloc for its allocations. */
|
||||
SCM_API int scm_install_gmp_memory_functions;
|
||||
|
||||
SCM_INTERNAL void scm_init_numbers (void);
|
||||
|
||||
#endif /* SCM_NUMBERS_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue