Smart pointers instead of GC?
deadalnix
deadalnix at gmail.com
Tue Jan 1 15:42:54 PST 2013
On Monday, 31 December 2012 at 12:14:22 UTC, Sven Over wrote:
> 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.
>
I understand that. However, refcounted stuff tends to die in
cluster as well and create pauses.
The main issue here is clearly GC's implementation rather than
the concept of GC in itself (which can be quite good at avoiding
pauses if you are ready to make some other tradeoffs).
> 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.
>
Here is something I tried in the past with some success : use
RefCounted and GC.free . Doing so, you allocate in the GC heap,
but you will limit greatly the amount of garbage that the GC have
to collect by itself.
Note that in some cases, GC means greater performances (usually
when associated with immutability), so disabling it entirely
don't seems a good idea to me.
More information about the Digitalmars-d
mailing list