Memory Safety without a GC or Ref Counting

Michel Fortin michel.fortin at michelf.ca
Mon Jan 21 16:46:25 PST 2013


On 2013-01-21 19:22:04 +0000, Jacob Carlborg <doob at me.com> said:

> On 2013-01-21 18:37, F i L wrote:
>> So I've been thinking about this problem off and on for awhile, and I
>> think I have a rather simple solution. I highly doubt I'm the first to
>> think of it, but haven't found any info about a similar idea on the net.
>> So in the interest of science I'm posting it here so anyone interested
>> can attempt to poke holes in the idea, which you folks have been so good
>> at in the past.
> 
> Seems a bit like ARC (Automatic Reference Counting) that Clang has 
> implemented for Objective-C (and some C libraries on Mac OS X). The 
> compiler automatically inserts calls to "retain" and "release" where 
> appropriate.

And I'll confirm that it's no magic either. Avoiding cyclic references 
isn't that easy when you start mixing implicitly retained pointers with 
Objective-C's blocks (lambas in C++ or delegate literals in D).

I'm a little sad Apple decided to deprecate its Objective-C garbage 
collector. Having the choice between GC and reference counting was 
great (although it surely sucks for library developers who need to 
support both modes).

-- 
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca/



More information about the Digitalmars-d mailing list