Smart pointers instead of GC?

Paulo Pinto pjmlp at progtools.org
Sat Feb 1 00:20:43 PST 2014


Am 01.02.2014 06:29, schrieb Manu:
> On 26 December 2012 00:48, Sven Over <dlang at svenover.de
> <mailto:dlang at svenover.de>> wrote:
>
>         std.typecons.RefCounted!T
>
>         core.memory.GC.disable();
>
>
>     Wow. That was easy.
>
>     I see, D's claim of being a multi-paradigm language is not false.
>
>
> It's not a realistic suggestion. Everything you want to link uses the
> GC, and the language its self also uses the GC. Unless you write
> software in complete isolation and forego many valuable features, it's
> not a solution.
>
>
>         Phobos does rely on the GC to some extent. Most algorithms and
>         ranges do not though.
>
>
>     Running (library) code that was written with GC in mind and turning
>     GC off doesn't sound ideal.
>
>     But maybe this allows me to familiarise myself more with D. Who
>     knows, maybe I can learn to stop worrying and love garbage collection.
>
>     Thanks for your help!
>
>
> I've been trying to learn to love the GC for as long as I've been around
> here. I really wanted to break that mental barrier, but it hasn't happened.
> In fact, I am more than ever convinced that the GC won't do. My current
> #1 wishlist item for D is the ability to use a reference counted
> collector in place of the built-in GC.
> You're not alone :)
>
> I write realtime and memory-constrained software (console games), and
> for me, I think the biggest issue that can never be solved is the
> non-deterministic nature of the collect cycles, and the unknowable
> memory footprint of the application. You can't make any guarantees or
> predictions about the GC, which is fundamentally incompatible with
> realtime software.


Meanwhile Unity and similar engines are becoming widespread, with C++ 
being pushed all the way to the bottom on the stack.

At least from what I hear in the gaming communities I hop around.

What is your experience there?

--
Paulo



More information about the Digitalmars-d mailing list