summaryrefslogtreecommitdiff
path: root/src/free_cache.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-11-08 17:04:45 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-11-08 17:04:45 +0000
commitd9d4a87efaf8eceac00e8f4f5a7a079d46d3244e (patch)
treeec0704ea2846301b6793e6beccfb67d1c55a5de4 /src/free_cache.c
parentb10c40de7fe6b7eaca6be5cc75ac5cb916e72d2c (diff)
downloadmpfr-d9d4a87efaf8eceac00e8f4f5a7a079d46d3244e.tar.gz
Change the way memory is allocated (as discussed partly in private).
* src/mpfr-gmp.c, src/mpfr-gmp.h, src/mpfr-impl.h: update. * src/free_cache.c, src/mpfr.h: added mpfr_mp_memory_cleanup function. * NEWS: describe API change. * TODO: added 2 related items (future clean-up and feature). * doc/mpfr.texi: update. * tests/talloc-cache.c: take API change into account. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11807 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/free_cache.c')
-rw-r--r--src/free_cache.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/free_cache.c b/src/free_cache.c
index 0b97a0247..2ca073884 100644
--- a/src/free_cache.c
+++ b/src/free_cache.c
@@ -149,3 +149,15 @@ mpfr_free_cache2 (mpfr_free_cache_t way)
#endif
}
}
+
+/* Function an application should call before mp_set_memory_functions().
+ This is currently equivalent to freeing the caches (and pools) since
+ they are allocated with GMP's current allocator. But this might change
+ in the future to avoid the drawback of having to free the caches just
+ because the allocators are changed: the caches could optionally be
+ allocated with malloc(). */
+void
+mpfr_mp_memory_cleanup (void)
+{
+ mpfr_free_cache ();
+}