Supports boot-time selection between the standard gc.c memory system (named "core") and a malloc-only system (named "malloc");
the "core" memory system is default.
Build:
./configure --prefix=... && make
Then try:
RUBY_MEM_SYS=malloc make install
or
RUBY_MEM_SYS=malloc:D make install # produces debug output using malloc-only.
RUBY_MEM_SYS=malloc:DL make install # produces debug output using malloc-only with @file:line.
Features not yet implemented: hooks for finalization, add hooks in gc.c for GC callbacks (weak reference/reference queue support).
Supports boot-time selection between the standard gc.c memory system (named "core") and a malloc-only system (named "malloc");
the "core" memory system is default.
Because GC.disable doesn't leverage memory debuggers (valgrind) effectively; gc.c still continues to allocate large chunks (heaps) via malloc(); thus valgrind can not distinguish between (and instrument) RVALUEs that are parceled from the large chunks in rb_newobj().
Also because this is a proof-of-concept prototype.
Because GC.disable doesn't leverage memory debuggers (valgrind) effectively; gc.c still continues to allocate large chunks (heaps) via malloc(); thus valgrind can not distinguish between (and instrument) RVALUEs that are parceled from the large chunks in rb_newobj().
I'm not "blaming" valgrind, I'm not even "blaming" gc.c. Valgrind has hooks for recognizing custom allocators, but only if the allocator is instrumented. It's obvious, MRI 1.9 uses some of the VALGRIND_*() hooks, however the hooks are enabled at compile-time.
Again, this is part of a proof-of-concept -- that different allocators and features can be selected at boot-time (and/or compile-time). This is not the final work -- there is a larger goal stated in the description.
BTW: using the RUBY_MEM_SYS=malloc allocator during "make" and "make install" appears to improve speed with only a modest memory increase. Some ruby programs are short-lived and do not create much collectable garbage.
If anyone thinks the larger goal, or even this dinky "malloc-only" allocator, is useful, please speak up. :)