![]() | This article is rated C-class on Wikipedia's
content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||||||||||||||||||||||||
|
![]() | This article is based on material taken from the Free On-line Dictionary of Computing prior to 1 November 2008 and incorporated under the "relicensing" terms of the GFDL, version 1.3 or later. |
Since when has reference counting been called "garbage collection"?
I thought that the taxonomy was:
I think it should be added that Perl also uses Reference Counting with no cycle detection [1]. Programmers should deal with cycles via proxy objects or something similar [2].
Obj-C/cocoa also uses reference counting, however it should be explicitly noted that reference counting in obj-C/cocoa is done manually by the programmer, which means that the overzealous count updates with list traversals don't happen in this language (for other reasons too, such as encapsulation, so for example an NSArray object would handle traversals and counts of items it owns without ever incrementing them. If you pull an object from an array, you increment its count manually to retain that you are now responsible for it, which is necessary anyway).
It should be noted that reference counting can be a form of garbage collection if it is done automatically. If automatic, then it's like a constant cycle of black-grey-white listing that automatically collects 'white' objects once they become unreachable. It should further be noted that by doing manual reference counting, you can avoid the (expensive) need to copy objects that are passed to functions or methods, since the methods increment their reference counts upon accepting them, so even if the previous owner decrements the count the object won't be prematurely dealloced and produce a dangling pointer for the current owner. Done this way, it can actually reduce the cost of manual memory management (by reducing the effective number of allocs required, since you no longer have to alloc copied objects because you don't need to copy them under normal circumstances).
wwww —Preceding unsigned comment added by 116.228.222.34 ( talk) 03:08, 19 March 2009 (UTC)
The COM section kind of a little contradicts itself by saying that:
while next explaining that
and then explaining that
The information is of course all true, except not very balanced. I think that "demonstrating the viability" is an advertizing statement, while "notoriously" demonstrate a detractor opinion. Could the truth be that a non-flawed system of perfect programmer discipline could theoretically use a reference counted distributed object system ("MiddleWare") of large scale, but that in real life of stressed careless programmers, this is an ephemeral state, and that then only a few fully trusted applications can be used. ... said: Rursus ( mbork³) 20:27, 29 September 2009 (UTC)
The term "disk operating system" keeps appearing in this article, but I also keep wondering if this term isn't obsolete and it should refer simply to "operating systems"? 84.209.121.30 ( talk) 20:33, 16 June 2010 (UTC)
The problem of fragmentation isn't mentioned at all in the article (it's only listed in the "Issues" at the bottom of the page). It would be great if somebody knowledgeable adds info about it. Ivant ( talk) 21:34, 28 December 2011 (UTC)
The statement "reference counting requires every memory-managed object to reserve space for a reference count" isn't true. In Apple's Objective C implementation, the reference count is stored in a global hash table (see this forum post, for example) and then only for reference counts greater than 1.
-- 212.140.132.200 ( talk) 12:49, 10 January 2012 (UTC)
The advantages section currently lists several myths. I have added citation needed to them. Here's a list:
Reference counting does not reclaim objects as soon as they can no longer be referenced. Doing so requires solving the halting problem in the general case.
Reference counting is not inherently incremental because decrements avalanche.
The claim that reference counting is simple is subjective. The mark-sweep GC in HLVM is less than 20 lines of code.
Tracing GC systems do not generally use finalizers for the destruction of scarce non-memory resources. For example, neither the JVM nor .NET do this.
The implication that determinism is an advantage of reference counting over tracing GC is dubious. Thread-safe reference counting with atomic decrements is non-deterministic in general because threads race to decrement to zero.
Statements about the regularity of GC cycles in tracing collectors as a function of free memory are pure speculation.
The article claims that tracing GC requires more space to be efficient compared to reference counting. Perhaps that is true under certain circumstances but I do not believe it is true in general. In particular, scope-based reference counting such as `shared_ptr` in C++ keeps floating garbage to the end of scope and, consequently, can have much higher memory requirements that generational garbage collection.
Finally, the discussion of functional programming languages is bogus. Almost all major FPLs (SML/NJ, MLton, OCaml, F#, Scala, Haskell, SBCL) use generational garbage collection with pointer bump allocators. Mathematica and Erlang are the only FPLs I can think of that can use reference counting and both are notoriously slow.
Hello fellow Wikipedians,
I have just added archive links to one external link on
Reference counting. Please take a moment to review
my edit. If necessary, add {{
cbignore}}
after the link to keep me from modifying it. Alternatively, you can add {{
nobots|deny=InternetArchiveBot}}
to keep me off the page altogether. I made the following changes:
When you have finished reviewing my changes, please set the checked parameter below to true to let others know.
This message was posted before February 2018.
After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than
regular verification using the archive tool instructions below. Editors
have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the
RfC before doing mass systematic removals. This message is updated dynamically through the template {{
source check}}
(last update: 5 June 2024).
Cheers.— cyberbot II Talk to my owner:Online 12:17, 1 January 2016 (UTC)
Hi, I'm a student. I'm having difficulty finding an accessible definition of a reference cycle. If a kind soul could link a page to a reference cycle or expand on the concept here on this page, it would help me and other students. 75.118.76.100 ( talk) 16:06, 7 December 2022 (UTC)
![]() | This article is rated C-class on Wikipedia's
content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||||||||||||||||||||||||
|
![]() | This article is based on material taken from the Free On-line Dictionary of Computing prior to 1 November 2008 and incorporated under the "relicensing" terms of the GFDL, version 1.3 or later. |
Since when has reference counting been called "garbage collection"?
I thought that the taxonomy was:
I think it should be added that Perl also uses Reference Counting with no cycle detection [1]. Programmers should deal with cycles via proxy objects or something similar [2].
Obj-C/cocoa also uses reference counting, however it should be explicitly noted that reference counting in obj-C/cocoa is done manually by the programmer, which means that the overzealous count updates with list traversals don't happen in this language (for other reasons too, such as encapsulation, so for example an NSArray object would handle traversals and counts of items it owns without ever incrementing them. If you pull an object from an array, you increment its count manually to retain that you are now responsible for it, which is necessary anyway).
It should be noted that reference counting can be a form of garbage collection if it is done automatically. If automatic, then it's like a constant cycle of black-grey-white listing that automatically collects 'white' objects once they become unreachable. It should further be noted that by doing manual reference counting, you can avoid the (expensive) need to copy objects that are passed to functions or methods, since the methods increment their reference counts upon accepting them, so even if the previous owner decrements the count the object won't be prematurely dealloced and produce a dangling pointer for the current owner. Done this way, it can actually reduce the cost of manual memory management (by reducing the effective number of allocs required, since you no longer have to alloc copied objects because you don't need to copy them under normal circumstances).
wwww —Preceding unsigned comment added by 116.228.222.34 ( talk) 03:08, 19 March 2009 (UTC)
The COM section kind of a little contradicts itself by saying that:
while next explaining that
and then explaining that
The information is of course all true, except not very balanced. I think that "demonstrating the viability" is an advertizing statement, while "notoriously" demonstrate a detractor opinion. Could the truth be that a non-flawed system of perfect programmer discipline could theoretically use a reference counted distributed object system ("MiddleWare") of large scale, but that in real life of stressed careless programmers, this is an ephemeral state, and that then only a few fully trusted applications can be used. ... said: Rursus ( mbork³) 20:27, 29 September 2009 (UTC)
The term "disk operating system" keeps appearing in this article, but I also keep wondering if this term isn't obsolete and it should refer simply to "operating systems"? 84.209.121.30 ( talk) 20:33, 16 June 2010 (UTC)
The problem of fragmentation isn't mentioned at all in the article (it's only listed in the "Issues" at the bottom of the page). It would be great if somebody knowledgeable adds info about it. Ivant ( talk) 21:34, 28 December 2011 (UTC)
The statement "reference counting requires every memory-managed object to reserve space for a reference count" isn't true. In Apple's Objective C implementation, the reference count is stored in a global hash table (see this forum post, for example) and then only for reference counts greater than 1.
-- 212.140.132.200 ( talk) 12:49, 10 January 2012 (UTC)
The advantages section currently lists several myths. I have added citation needed to them. Here's a list:
Reference counting does not reclaim objects as soon as they can no longer be referenced. Doing so requires solving the halting problem in the general case.
Reference counting is not inherently incremental because decrements avalanche.
The claim that reference counting is simple is subjective. The mark-sweep GC in HLVM is less than 20 lines of code.
Tracing GC systems do not generally use finalizers for the destruction of scarce non-memory resources. For example, neither the JVM nor .NET do this.
The implication that determinism is an advantage of reference counting over tracing GC is dubious. Thread-safe reference counting with atomic decrements is non-deterministic in general because threads race to decrement to zero.
Statements about the regularity of GC cycles in tracing collectors as a function of free memory are pure speculation.
The article claims that tracing GC requires more space to be efficient compared to reference counting. Perhaps that is true under certain circumstances but I do not believe it is true in general. In particular, scope-based reference counting such as `shared_ptr` in C++ keeps floating garbage to the end of scope and, consequently, can have much higher memory requirements that generational garbage collection.
Finally, the discussion of functional programming languages is bogus. Almost all major FPLs (SML/NJ, MLton, OCaml, F#, Scala, Haskell, SBCL) use generational garbage collection with pointer bump allocators. Mathematica and Erlang are the only FPLs I can think of that can use reference counting and both are notoriously slow.
Hello fellow Wikipedians,
I have just added archive links to one external link on
Reference counting. Please take a moment to review
my edit. If necessary, add {{
cbignore}}
after the link to keep me from modifying it. Alternatively, you can add {{
nobots|deny=InternetArchiveBot}}
to keep me off the page altogether. I made the following changes:
When you have finished reviewing my changes, please set the checked parameter below to true to let others know.
This message was posted before February 2018.
After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than
regular verification using the archive tool instructions below. Editors
have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the
RfC before doing mass systematic removals. This message is updated dynamically through the template {{
source check}}
(last update: 5 June 2024).
Cheers.— cyberbot II Talk to my owner:Online 12:17, 1 January 2016 (UTC)
Hi, I'm a student. I'm having difficulty finding an accessible definition of a reference cycle. If a kind soul could link a page to a reference cycle or expand on the concept here on this page, it would help me and other students. 75.118.76.100 ( talk) 16:06, 7 December 2022 (UTC)