LinkedIn Article to be: Why you need to start moving off C/C++ to D, now.

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 15 13:42:58 PDT 2014


On Tue, Jul 15, 2014 at 10:16:33PM +0200, Paulo Pinto via Digitalmars-d wrote:
> Am 15.07.2014 22:03, schrieb Chris:
> >On Monday, 14 July 2014 at 23:43:57 UTC, H. S. Teoh via Digitalmars-d
> >wrote:
> >>On Mon, Jul 14, 2014 at 11:22:53PM +0000, John Carter via
> >>Digitalmars-d wrote:
> >>[...]
> >>>Any other good blog posts / social media comments / pointers I can
> >>>digest and use?
> >>
> >>This one came to mind:
> >>
> >>http://bartoszmilewski.com/2013/09/19/edward-chands/
> >>
> >>
> >
> > From the link above:
> >
> >"It’s a common but false belief that reference counting (using shared
> >pointers in particular) is better than garbage collection. There is
> >actual research* showing that the two approaches are just two sides
> >of the same coin. You should realize that deleting a shared pointer
> >may lead to an arbitrary long pause in program execution, with
> >similar performance characteristics as a garbage sweep. It’s not only
> >because every serious reference counting algorithm must be able to
> >deal with cycles, but also because every time a reference count goes
> >to zero on a piece of data a whole graph of pointers reachable from
> >that object has to be traversed. A data structure built with shared
> >pointers might take a long time to delete and, except for simple
> >cases, you’ll never know which shared pointer will go out of scope
> >last and trigger it."
> >
> >* http://www.cs.virginia.edu/~cs415/reading/bacon-garbage.pdf
> 
> +1 :)

+100. :-)

The only way to *really* guarantee 100% predictable memory reclamation
is to write your own. Except that we all know how scalable and bug-free
that is. Not to mention, when you need to deallocate a large complex
data structure, *somebody* has to do the work -- either you do it
yourself, or the reference counting implementation, or the GC. No matter
how you cut it, it's work that has to be done, and you have to pay for
it somehow; the cost isn't going to magically disappear just because you
use reference counting (or whatever other scheme you dream up).


T

-- 
Klein bottle for rent ... inquire within. -- Stephen Mulraney


More information about the Digitalmars-d mailing list