[m-rev.] diff: Setup an OOM callback with Boehm GC
Julien Fischer
jfischer at opturion.com
Wed Jun 8 21:06:34 AEST 2016
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)
Julien.
More information about the reviews
mailing list