Smart pointers instead of GC?

Steven Schveighoffer schveiguy at yahoo.com
Tue Feb 4 12:16:20 PST 2014


On Tue, 04 Feb 2014 15:10:48 -0500, deadalnix <deadalnix at gmail.com> wrote:

> On Tuesday, 4 February 2014 at 19:28:08 UTC, Steven Schveighoffer wrote:
>> Where you have to be cognizant is avoiding cycles. Plain and simple.  
>> And it's not that difficult. The compiler takes care of the rest. It's  
>> somewhat magical I suppose :) Managing your autorelease pools can make  
>> a difference, but is not necessarily critical.
>>
>
> My experience is that, just like null reference, it is highly dependent  
> on the type of code you are facing.
>
> Typically, you'll have trouble with complex graph of objects.

This is very true. I have only dealt with acyclic (except for parent  
pointers) graphs or linked-lists.

For specialized cases, you will have to NULL out the pointers to/from a  
node that has to be deleted (essentially a manual delete).

But it works VERY well for linked-lists/queues. My app is I/O intensive,  
so I have a lot of that.

-Steve


More information about the Digitalmars-d mailing list