1 ///////////////////////////////////////////////////////////////
2 // Copyright 2011 John Maddock. Distributed under the Boost
3 // Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
6 #include "sf_performance.hpp"
8 unsigned allocation_count = 0;
10 void* (*alloc_func_ptr)(size_t);
11 void* (*realloc_func_ptr)(void*, size_t, size_t);
12 void (*free_func_ptr)(void*, size_t);
14 void* alloc_func(size_t n)
17 return (*alloc_func_ptr)(n);
20 void free_func(void* p, size_t n)
22 (*free_func_ptr)(p, n);
25 void* realloc_func(void* p, size_t old, size_t n)
28 return (*realloc_func_ptr)(p, old, n);
33 using namespace boost::multiprecision;
35 #if defined(TEST_MPFR) || defined(TEST_MPFR_CLASS) || defined(TEST_MPREAL) || defined(TEST_MPF)
36 mp_get_memory_functions(&alloc_func_ptr, &realloc_func_ptr, &free_func_ptr);
37 mp_set_memory_functions(&alloc_func, &realloc_func, &free_func);