[m-users.] Too Slow
novalazy at gmail.com
Mon May 4 14:51:10 AEST 2015
On Sat, 02 May 2015 14:06:18 +0100, Matthias Guedemann <matthias.guedemann at googlemail.com> wrote:
> > 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
The advantage would be that you can use libtommath in its default
configuration. Also, as Mark said, you're supposed to call mp_clear
because the library author said so. We're relying on an implementation
detail that mp_clear doesn't do anything useful for us.
There are no practical alternatives to non-Boehm C grades on the
More information about the users