From 4d77f3810f657a23126ec8053c1a304b4def6913 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 21 Mar 2021 05:31:06 +0300 Subject: [PATCH] gc: enable on macos and add leak detection fns --- vlib/builtin/builtin_d_gcboehm.v | 8 +++++++- vlib/v/gen/c/cgen.v | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/vlib/builtin/builtin_d_gcboehm.v b/vlib/builtin/builtin_d_gcboehm.v index f607487c34..434018ff34 100644 --- a/vlib/builtin/builtin_d_gcboehm.v +++ b/vlib/builtin/builtin_d_gcboehm.v @@ -9,10 +9,16 @@ $if windows { #include -#flag -lgc +#flag linux -lgc +#flag darwin @VROOT/thirdparty/bdwgc/extra/.libs/gc.o fn C.GC_MALLOC(n size_t) voidptr fn C.GC_REALLOC(ptr voidptr, n size_t) voidptr fn C.GC_FREE(ptr voidptr) + +fn C.GC_set_find_leak(int) + +// fn C.CHECK_LEAKS() +fn C.GC_gcollect() diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index f985608e13..9c5db0b11d 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -5168,7 +5168,7 @@ fn (mut g Gen) write_init_function() { // g.writeln('g_str_buf = malloc( ${mb_size} * 1024 * 1000 );') } if g.pref.prealloc { - g.writeln('g_m2_buf = malloc(50 * 1000 * 1000);') + g.writeln('g_m2_buf = malloc(150 * 1000 * 1000);') g.writeln('g_m2_ptr = g_m2_buf;') } // NB: the as_cast table should be *before* the other constant initialize calls,