[m-users.] Too Slow

Matthias Guedemann matthias.guedemann at googlemail.com
Sat May 2 23:06:18 AEST 2015


> It's not very convenient, but libtommath does provide a way to
> override the allocation functions that it uses: by defining the
> preprocessor symbols XMALLOC/XREALLOC/XCALLOC/XFREE when building the
> library, e.g.

>     CFLAGS='-DXMALLOC=MR_GC_malloc -DXREALLOC=MR_GC_realloc \
> -DXCALLOC=MR_GC_calloc -DXFREE=GC_free' make

> The Mercury binding would not call mp_clear explicitly, but it would
> be unnecessary to do so.

This seems to work perfectly, thanks for the idea.

> Another possibility is to register finalisation functions with Boehm
> GC for every mp_int, but that is something to avoid if possible.

Would there be an advantage using this option? If I understand
correctly, this would be very Boehm-GC centric; on the other hand, is
there a high probability that any non-Boehm C grade will get widely
used? For Java/C# and Erlang, they have their own implementations of
bigintegers.

Best regards
Matthias



More information about the users mailing list