+#if GC
+static void *(*do_malloc)(size_t) = GC_malloc;
+static void *(*do_realloc)(void *, size_t) = GC_realloc;
+static void *(*do_malloc_atomic)(size_t) = GC_malloc_atomic;
+static void (*do_free)(void *) = GC_free;
+#else
+static void *(*do_malloc)(size_t) = malloc_and_zero;
+static void *(*do_realloc)(void *, size_t) = realloc;
+static void *(*do_malloc_atomic)(size_t) = malloc;
+static void (*do_free)(void *) = free;
+#endif
+
+/** @brief Initialize memory management
+ *
+ * Must be called by all programs that use garbage collection. Define
+ * @c ${DISORDER_GC} to @c no to suppress use of the collector
+ * (e.g. for debugging purposes).
+ */
+void mem_init(void) {
+#if GC