A betterC base

Paulo Pinto pjmlp at progtools.org
Sat Feb 10 19:41:49 UTC 2018


On Saturday, 10 February 2018 at 19:22:51 UTC, Jonathan M Davis 
wrote:
> On Saturday, February 10, 2018 14:06:09 Timon Gehr via 
> Digitalmars-d wrote:
>> On 08.02.2018 16:55, JN wrote:
>> > On Thursday, 8 February 2018 at 14:54:19 UTC, Adam D. Ruppe 
>> > wrote:
>> >> Garbage collection has proved to be a smashing success in 
>> >> the industry, providing productivity and memory-safety to 
>> >> programmers of all skill levels.
>> >
>> > Citation needed on how garbage collection has been a 
>> > smashing success based on its merits rather than the merits 
>> > of the languages that use garbage collection. Python was 
>> > also a smashing success, but it doesn't use a garbage 
>> > collector in it's default implementation (CPython). Unless 
>> > you mean garbage collection as in "not manual memory 
>> > management"? ...
>>
>> Even if "garbage collection" is taken to mean "collecting 
>> garbage", reference counting is garbage collection. Referring 
>> to RC as not GC makes no sense at all and was probably only 
>> invented because some people want to think that RC is good but 
>> GC is bad, being too lazy to say "tracing GC".
>
> Except that RC and what folks typically mean what they talk 
> about GC are fundamentally different. Yes, they both 
> automatically free memory for you, but one is deterministic, 
> whereas the other involves periodically running a collection to 
> find memory that can be freed. So, yes, in a sense, RC is a 
> form of GC, but they're very different beasts.
>
> - Jonathan M Davis

People like to think that RC is deterministic.

First of all, unless they are atomic, there are no guarantees of 
pause time during locking on counter access.

Second, Herb Sutter has a great CppCon talk about 
non-deterministic releases, with the possibility of stack 
overflow, in complex datastructures.

Herb Sutter “Leak-Freedom in C++... By Default.”

https://www.youtube.com/watch?v=JfmTagWcqoE




More information about the Digitalmars-d mailing list