From f5edbc278b684da978b0c0ab67f1dbead4329ece Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 15 May 2025 15:56:40 +0200 Subject: [PATCH] Add warn proc to bdw --- src/bdw.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bdw.c b/src/bdw.c index fa06f7256..fc228c15e 100644 --- a/src/bdw.c +++ b/src/bdw.c @@ -558,6 +558,11 @@ static void* oom_fn(size_t nbytes) { return NULL; } +static void warn_fn(char *fmt, GC_word arg) { + /* FIXME: Do something better with this. */ + fprintf (stderr, fmt, arg); +} + void gc_heap_set_allocation_failure_handler(struct gc_heap *heap, void* (*handler)(struct gc_heap*, size_t)) { @@ -616,6 +621,7 @@ int gc_init(const struct gc_options *options, struct gc_stack_addr stack_base, snprintf(markers, sizeof(markers), "%d", options->common.parallelism); setenv("GC_MARKERS", markers, 1); GC_init(); + GC_set_warn_proc (warn_fn); size_t current_heap_size = GC_get_heap_size(); if (options->common.heap_size > current_heap_size) GC_expand_hp(options->common.heap_size - current_heap_size);