
Hi Vitor,
I believe that calling mp_set_memory_functions repeatedly would mean that we must abandon all the guarantees provided by GMP's interface. In fact, the following paragraph is taken from GMP's manual:
@strong{Be sure to call @code{mp_set_memory_functions} only when there are no active GMP objects allocated using the previous memory functions! Usually that means calling it before any other GMP function.}
Ciao
Roberto
Hi Roberto,
I changed the Yap GMP allocation routines to fall back to malloc/realloc/free if outside context. I think that is the best solution for two reasons:
- It is the most general: external processes might not want their objects to disappear during backtracking. - It avoids nasty interactions with the garbage collector: even I disallow gc of these objects, is application is not prepared for the gc barging in and shifting objects around?
I haven't actually tested it outside Yap, do you mind trying it and telling me it works?
Thanks
Vitor