[mercury-users] BoehmGC: Exclusion ranges overlap

Jonathan Morgan jonmmorgan at gmail.com
Fri Mar 3 10:09:07 AEDT 2006


I was getting a wierd error yesterday on the Computer Science (Solaris)
servers, using mercury-0.12.2.

My application would build properly, but the following (borrowed from
mtcltk) caused it to abort, saying exclusion ranges overlap.  This seems to
be related to BoehmGC.  Is there anything wrong with the way I am using
this, or is it just no longer necessary?  It seems to work allright with Tk.

:- pragma foreign_code("C", "

#ifdef MR_CONSERVATIVE_GC

/*
** The addresses of the closures that we pass to Tk
** will be stored by Tk in malloc()'ed memory.
** However, it is essential that these pointers be
** visible to the garbage collector, otherwise it will
** think that the closures are unreferenced and reuse the storage.
** Hence we redefine malloc() and friends to call GC_malloc().
*/

void *malloc(size_t s)
{
    return GC_MALLOC(s);
}

void *calloc(size_t s, size_t n)
{
    void *t;
    t = GC_MALLOC(s*n);
    memset(t, 0, s*n);
    return t;
}

void *realloc(void *ptr, size_t s)
{
    return GC_REALLOC(ptr, s);
}

void free(void *ptr)
{
    GC_FREE(ptr);
}

#endif /* MR_CONSERVATIVE_GC */

").

Jon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20060303/31123a2e/attachment.html>


More information about the users mailing list