GC debug methods

I noticed that bdwgc has optional

GC_debug_malloc , GC_debug_malloc_atomic , GC_debug_realloc , and GC_debug_free
methods, which are said to contain additional debug information and check for inconsistencies more aggressively: GitHub - ivmai/bdwgc: The Boehm-Demers-Weiser conservative C/C++ Garbage Collector (bdwgc, also known as bdw-gc, boehm-gc, libgc)

Would it make sense to use these if compiling in development mode? Thanks!

I believe those are aimed for debugging problems with the GC itself. I don’t think we need them in development mode by default.

" The routines GC_debug_malloc, GC_debug_malloc_atomic, GC_debug_realloc, and GC_debug_free provide an alternate interface to the collector, which provides some help with memory overwrite errors, and the like. Objects allocated in this way are annotated with additional information. Some of this information is checked during garbage collections, and detected inconsistencies are reported to stderr.

Simple cases of writing past the end of an allocated object should be caught if the object is explicitly deallocated, or if the collector is invoked while the object is live."

So it basically checks for user code writing past the end of allocated memory. At the cost of some runtime. Might be interesting?