Smart pointers instead of GC?

Sven Over dlang at svenover.de
Mon Dec 31 04:14:21 PST 2012


On Tuesday, 25 December 2012 at 19:23:59 UTC, Jonathan M Davis 
wrote:
> There's also often no reason not to have the GC on and use it 
> for certain stuff

One thing that really freaks me out is the fact that the garbage 
collector pauses the whole process, i.e. all threads.

In my job I'm writing backend services that power a big web site. 
Perfomance is key, as the response time of the data service in 
most cases directly adds to the page load time. The bare 
possibility that the whole service pauses for, say, 100ms is 
making me feel very uncomfortable.

We easily achieve the performance and reliability we need in C++, 
but I would love to give D a chance, as it solves many 
inconveniences of C++ in an elegant way. Metaprogramming and the 
threading model, just to name two.

> For instance, arrays would probably be GC-allocated in general, 
> since
> then you can use slices and whatnot,

A smart-pointer type for arrays can easily provide slices. It 
keeps a reference to the full array (which gets destructed when 
the last reference is dropped), but addresses a subrange.

Thanks everyone for all the replies!


More information about the Digitalmars-d mailing list