summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2020-02-25 23:36:09 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2020-02-25 23:48:49 -0800
commit55923ba88366658c6bfdecd8b0b25070d70c569d (patch)
tree73fe5eefbb95e30f115f06948ba857aa72053d8a
parent8dab71b9d0e9d2054dfb8d703656d4e6712a9efd (diff)
Note a situation around xmalloc vs free in MJIT [ci skip]
shared by ko1
-rw-r--r--mjit_worker.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/mjit_worker.c b/mjit_worker.c
index f55942e0db..117bcb786c 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -10,6 +10,19 @@
// call Ruby methods (C functions that may call rb_funcall) or trigger
// GC (using ZALLOC, xmalloc, xfree, etc.) in this file.
+/* However, note that calling `free` for resources `xmalloc`-ed in mjit.c,
+ which is currently done in some places, is sometimes problematic in the
+ following situations:
+
+ * malloc library could be different between interpreter and extensions
+ on Windows (perhaps not applicable to MJIT because CC is the same)
+ * xmalloc -> free leaks extra space used for USE_GC_MALLOC_OBJ_INFO_DETAILS
+ (not enabled by default)
+
+ ...in short, it's usually not a problem in MJIT. But maybe it's worth
+ fixing for consistency or for USE_GC_MALLOC_OBJ_INFO_DETAILS support.
+*/
+
/* We utilize widely used C compilers (GCC and LLVM Clang) to
implement MJIT. We feed them a C code generated from ISEQ. The
industrial C compilers are slower than regular JIT engines.