--- src/sage/libs/pari/pari_instance.pxd.orig 2014-05-10 15:49:08.954184083 -0300 +++ src/sage/libs/pari/pari_instance.pxd 2014-05-10 15:49:13.304183771 -0300 @@ -5,6 +5,10 @@ cimport cython from sage.libs.pari.gen cimport gen +cdef extern from "gmp.h": + cdef void mp_get_memory_functions(void**, void**, void**) + cdef void mp_set_memory_functions(void*, void*, void*) + cpdef long prec_bits_to_words(unsigned long prec_in_bits) @cython.final --- src/sage/libs/pari/pari_instance.pyx.orig 2014-05-10 15:49:06.437184263 -0300 +++ src/sage/libs/pari/pari_instance.pyx 2014-05-10 15:49:13.307183771 -0300 @@ -437,7 +437,12 @@ cdef class PariInstance(sage.structure.p # The size here doesn't really matter, because we will allocate # our own stack anyway. We ask PARI not to set up signal and # error handlers. + cdef void *_gmp_malloc + cdef void *_gmp_realloc + cdef void *_gmp_free + mp_get_memory_functions(&_gmp_malloc, &_gmp_realloc, &_gmp_free) pari_init_opts(10000, maxprime, INIT_DFTm) + mp_set_memory_functions(_gmp_malloc, _gmp_realloc, _gmp_free) _pari_init_error_handling()