On 2/6/14, 7:11 AM, ponce wrote:
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.

I think of RC as a greater evil that GC. From what I've seen it does
creates leaking cycles in tree structures AND pauses. From a low-level
point of view, RC pointers are ugly (separate counter that will trash
your cache) and do atomics all over the place (ie. memory barriers).
That they don't have to because of shared is TBD.

It is comforting to me to know that a GC pointer is still just a
pointer. If we go the RC route, we will have to constantly think about
the higher cost of RC pointer vs weak-ref, instead of thinking about
other things instead
Right now a GC pointer is the same size as a non-GC one, it's liberating.

It looks like we want to solve a PR problem more than a real one.

Though I partly agree with your considerations, let me note that PR problems are real.

Andrei

Reply via email to