[m-rev.] diff: Setup an OOM callback with Boehm GC
Paul Bone
paul at bone.id.au
Thu Jun 9 14:59:41 AEST 2016
On Wed, Jun 08, 2016 at 09:06:34PM +1000, Julien Fischer wrote:
>
>
> On Wed, 8 Jun 2016, Paul Bone wrote:
>
> > Setup an OOM callback with Boehm GC
> >
> > This is a simplier way to get an earlier abort when we run out of memory.
> > it also prints out the requested allocation size.
> >
> > runtime/mercury_wrapper.c:
> > As above.
> > ---
> > runtime/mercury_wrapper.c | 14 ++++++++++++++
> > 1 file changed, 14 insertions(+)
> >
> > diff --git a/runtime/mercury_wrapper.c b/runtime/mercury_wrapper.c
> > index 0afabc5..dccc785 100644
> > --- a/runtime/mercury_wrapper.c
> > +++ b/runtime/mercury_wrapper.c
> > @@ -831,6 +831,18 @@ mercury_runtime_init(int argc, char **argv)
> > #error "MR_HIGHTAGS is incompatible with MR_CONSERVATIVE_GC"
> > #endif
> >
> > +/*
> > + * Boehm will call this callback when it runs out of memory, We print an
> > + * error and abort. Our error is printed after Boehm GC's on error, so we
> > + * don't need to say much.
> > + */
> > +#ifdef MR_BOEHM_GC
> > +static void *MR_oom_func(size_t bytes)
>
> Shouldn't that actually be:
>
> static void * GC_CALLBACK MR_oom_func(size_t bytes)
>
> ? (So it matches the definition of the type GC_oom_fn)
Yes, it probably should. Although it looks as if GC_CALLBACK doesn't
currently expand to anything.
--
Paul Bone
More information about the reviews
mailing list