[m-users.] Too Slow

Peter Wang novalazy at gmail.com
Fri May 1 17:54:38 AEST 2015


On Fri, 01 May 2015 07:02:48 +0100, Matthias Guedemann <matthias.guedemann at googlemail.com> wrote:
> Hi Peter,
> 
> > You should allocate the mp_ints like this:
> 
> >     Mp_Int = MR_GC_NEW_ATTRIB(mp_int, MR_ALLOC_ID);
> 
> > For the string in mp_to_string you should use
> 
> >     MR_allocate_aligned_string_msg(S, length, MR_ALLOC_ID);
> 
> > or other macros in mercury_string.h
> 
> ok, thank you for the hints. Could you point me to the relevant section
> in the user guide, or is the documentation only in the source files?

Unfortunately the latter (mercury_memory.h and mercury_string.h).
I think no memory management interface has been documented because
the existing interface is specific to conservative GCs, if not Boehm
GC.  Nonetheless, practical code using the foreign language interface
invariably needs to allocate so I think we should document some of the
macros and functions, with caveats.

Peter



More information about the users mailing list