Rebrand GC as "automatic memory leak detection and cleanup"

James Lu jamtlu at gmail.com
Mon Apr 12 22:47:29 UTC 2021


As noted in another thread:

> * The garbage collector eliminates probably 60% of potential 
> users right off.

If we rename garbage collection to "automatic memory leak 
detection and cleanup." For people who write realtime 
applications, that's what it is. D is garbage collected in the 
sense that it's available as an option.

Walter noted that with 20+ years of experience writing manually 
managed code, he still could not write leak-free programs.

I propose:

* Rename GC to automatic memory leak detection and cleanup in 
documentation
* Make core.memory.__delete a better name. Perhaps 
core.memory.free.
* Runtime should have an option to emit a warning every time an 
object is cleaned up on the major heap. There should be a 
compiler or runtime option that attaches debug information so we 
stack trace of the allocation. Optionally, this could be enabled 
for certain classes via a UDA.
* If possible, a compiler and/or runtime option to safely detect 
and warn on double-frees. That way, we can boast being 
memory-safe.

As someone who writes a realtime, major-GC-is-not-allowed 
JavaScript game, having the stack trace of where an object is 
leaked helps fixing garbage generation greatly.


More information about the Digitalmars-d mailing list