On Thursday, 6 February 2014 at 11:37:59 UTC, Max Klyga wrote:
Anti-GC crowd tries to promote ARC as an deterministic
alternative for memory management.
I noticed that people promoting ARC do not provide any
disadvantages for proposed approach.
The thing is in gamedev and other soft-realitime software
background only a handfull types of resources are really
managed by RC and memory usage patterns are VERY specific to
their domain (mostly linear allocation/deallocation and objects
with non deterministic lifetime are preallocated in pools).
Trying to use RC as a general method of memory management leads
to some problems.
A pretty detailed view by John Harrop (He is somewhat known for
trolling in PL community, but nonetheless knows what he is
talking about) -
http://www.quora.com/Computer-Programming/How-do-reference-counting-and-garbage-collection-compare/answer/Jon-Harrop-1?srid=3Gvg&share=1#
So RC could also introduce unpredictable pause times at
undesired places.
This is also confirmed by research from HP -
http://www.hpl.hp.com/personal/Hans_Boehm/popl04/refcnt.pdf
My point is that we should not ruin the language ease of use.
We do need to deal with Phobos internal allocations, but we
should not switch to ARC as a default memory management scheme.
In practice people promoting ARC will probably not use phobos
anyway. Currently its just an excuse to not use D.
Look at c++ and STL, etc. People will roll their own solutions
no matter what you try.
Nicely said.
I believe both approaches should be available. Those who must
work without GC should be able to easily do that, but GC should
be picked as default simply because it is better for general
programming tasks. If D turns out to be used for something else,
and majority of use-cases require GC to be off, perhaps D should
switch to no-GC by default. I do not see this happening, to be
honest.
This is somewhat similar to final-by-default crowd who wants
class methods to be final, not virtual by default. Again, D
should provide means to satisfy both crowds, because I think it
is possible.