More radical ideas about gc and reference counting

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Mon May 12 10:03:20 PDT 2014


On 5/12/2014 2:12 AM, Dicebot wrote:
> I think this is more of library writing culture problem than engineering
> problem. High quality library shouldn't rely on any internal allocations at all,
> deferring this decision to user code. Otherwise you will eventually have
> problems, GC or not.

Consider my PR:

  https://github.com/D-Programming-Language/phobos/pull/2149

This is exactly what it does - it 'pushes' the decisions about allocating memory 
up out of the library to the user. I suspect a great deal of storage allocation 
can be removed from Phobos with this technique, without sacrificing performance, 
flexibility, or memory safety. (In fact, it improves on performance and 
flexibility!)


I also agree with your larger point that if you are relying on an unknown 
library for time critical code, and that library was not designed with time 
criticality guarantees in mind, you're going to have nothing but trouble. 
Regardless of GC or RC.


More information about the Digitalmars-d mailing list