Talk:Garbage collection (computer science)/Archive 1

From Wikipedia, the free encyclopedia

This is an archive of past discussions. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page.
Archive 1 Archive 2 →

Contents

Copying collection

"...determine what data objects in a program cannot possibly be needed; throw them away."

Is this correct? My understanding of copying collection is that nothing is actually thrown away, but rather that reachable objects are explicitly kept. If that is the case, then wouldn't that phrasing be a bit misleading? --maw

The storage used by the objects that are collected is reclaimed by some means, presumably to be used again for the creation of fresh objects. Thrown away is too imprecise, will edit. --drj


GC-collected languages and not

"It is a bit sloppy to talk of a garbage collected language just as it is slightly incorrect to talk of a compiled language. Being garbage collected is a property of an implementation of a language."

Surely this is incorrect for languages where the semantics specify no way of recycling cells? Certainly, most languages that use garbage collection (in fact, all other than those that can be conservatively collected through third-party tools) have no explicit free operation, and this is part of the design of the language more than an implementation detail. --Andy C King


Pseudo-code

What one Earth is the example pseudocode about? It's presumably an attempt to show how one can create a memory leak in a GC'd system, but I don't understand it at all. Any comments? —Cadr

Try translating the code into C or something you know. As it is now, it is kind of Bourne shell script code mixed with some C. --Falcon 16:48, Mar 25, 2004 (UTC)
I agree that this example seems quite obtuse and requires more explanation (to say nothing of copy-editing). Also, left to right assignment is unconventional at best. I'll fix this up sometime, if someone doesn't beat me to it. --Deco 21:56, 25 Mar 2004 (UTC)
Copy-editing? I wrote it myself! Unless, of course, you are using the term as something else. --Falcon 00:12, Mar 26, 2004 (UTC)
I'm not attacking you, but there are several language errors in the text, some of which affect comprehension or flow. Here's a small listing; I hope you find it helpful.
"...a very poor way of programming; especially when... a garbage collector is"
The semicolon should be a comma, because the following part is a dependent clause.
"There is some proof to this claim."
This should be "some evidence for this claim" or something to that effect.
..."let a program be created which runs on an infinite loop, in a..."
This is rather stilted; better would be, "Consider the following program, which runs indefinitely, written in a..."
"The program above multiplies the number of bacteria by three, losing the reference to all, and keeps a count of them."
The program repeatedly multiplies the number of bacteria by three; your text seems to imply it only does this once. "losing the reference to all" doesn't make sense; maybe you meant "to all of them"; In "keeps a count of them", it's not clear what "them" is referring to.
"This program ... continiously ... which means that much garbage remains after the garbage collector is finished, thus wasted memory."
"Continuously" is misspelled; moreover, you mean continually, or repeatedly. The word "thus" should be followed by a complete sentence, not just a noun phrase, such as "thus memory is wasted". This is also a run-on, so a better fix would be "and so memory is wasted".
I'd make these edits myself, but I'm planning to rewrite the whole thing to make it simpler. I hope you're not offended. --Deco 05:28, 26 Mar 2004 (UTC)
Okay, after closer examination of this code, the example actually appears to be invalid. The references are lost, and so the objects will eventually be collected; it may take a while, and so the number will certainly increase, but it will suddenly decrease as soon as the GC is invoked. I think this might stem from a misunderstanding of the author, who believed that GC is always prompt; really, as far as I know, this is only true with acyclic reference counting, and this is a limitation of GC, but not as stated. --Deco 05:41, 26 Mar 2004 (UTC)
I'm creating a new section called "Disadvantages of Tracing Garbage Collectors, which will incorporate Falcon's example properly. I hope everyone is happy with this arrangement. --Deco 05:52, 26 Mar 2004 (UTC)


other comments

a "moving GC" is the same as a "copying GC" - right? Can we pick one consistent term, at least for this article? --DavidCary 04:23, 2 Apr 2004 (UTC)

There is a distinction. Copying GC is a moving GC, but not all moving GCs are copying GCs. "Moving", although probably not a standard term, only implies that it does its job partly by relocating objects. --Deco 22:09, 2 Apr 2004 (UTC)
"There is a distinction"? I still don't understand the distinction. Please make that distinction in the article. Thank you. --DavidCary 02:20, 21 May 2004 (UTC)
Frankly, the article makes it quite clear what each of these things is, and doesn't even suggest that they're the same. I don't see why there's a need for clarification, unless this is really a common source of confusion. I have reworded the definition of copying GC to be a bit clearer, however. --Deco 22:19, 21 May 2004 (UTC)
I must be blind then. Is there such a thing as a "moving GC" that is not a "copying GC"? Would it be OK to mention this thing in the article? --DavidCary 21:10, 22 May 2004 (UTC)
According the The Memory Management Reference, moving garbage collection applies "to copying collectors and to mark-compact collectors [and] may also refer to replicating collectors." The distinction never made much sense to me (in the use of words), but there are clearly differences of technique in how references are fixed, and in whether something (such as a broken heart) remains in the old location. --Bovlb 21:59, 2004 May 23 (UTC)


Grammar

The latest anonymous IP editor seems to have misunderstood the intent of the sentence they changed. I'll see if I can reword it better. --Deco 05:20, 7 Sep 2004 (UTC)


Odd title

Am I the only one who finds the article title Automatic garbage collection odd? I certainly don't hear this phrase used too much. Perhaps Garbage collection (computer science) would be more appropriate. --Deco 23:30, 20 Sep 2004 (UTC)

It sounds odd to me as well. While the term automatic garbage collection is well-understood, garbage collection almost always means automatic one. I mean, I have never heard of non-automatic garbage collection, even if there is such a thing. I rather am curious why automatic was put in the first place. --Taku 00:53, Sep 21, 2004 (UTC)
That's clear enough: disambiguation with the process of actually collecting real garbage (see Garbage collection). I have used this term used in this context on occasion. That's why I suggested the parenthesized category. Hopefully we can get a small consensus among this page's editors on this. --Deco 07:37, 21 Sep 2004 (UTC)
I went ahead and changed the article name. I think this is better. I set a 'bot on skipping redirects and having everything point straight to the new name. I apologise if it was a bit overzealous, and I hope everyone likes the new name. --Deco 00:25, 3 Oct 2004 (UTC)

BASIC's gcing

Does BASIC have garbage collection or does Visual Basic have garbage collection? If it's the latter, I think it should be emphasized in the article. --Silver hr 05:32, 21 Jun 2005 (UTC)

Garbage collected programming languages

TakuyaMurata recently removed the list of GCed languages. Rather that dispute that edit, I am instead proposing the creation of a new sub-category of Category:Programming languages called something like "Garbage collected programming languages" or "Programming languages that rely on automatic memory management". This category would then consist of the list removed in this edit, and would be referenced under "See also" as Category:Memory management software is now. Comments? I'm happy to do this, but I'd like some feedback on the name first because it's a pain to rename categories. --Bovlb 01:29:30, 2005-08-25 (UTC)

I agree with the caveat that the category page should explain the technicality that for many of these languages, GC is not part of the language per se but part of the most widespread implementations of that language. --Deco 04:33, 25 August 2005 (UTC)
Hmm. For most or all of the languages listed, GC (or, to be precise, automatic memory management) is essentially required by the language definition, there being no manual way to free memory. Can you give an example of a language where it's not required, but is commonly provided? I would prefer to put that in a different category. --Bovlb 04:54:08, 2005-08-25 (UTC)
Managed C++ and its progeny in Microsoft .NET lets you allocate both (garbage-collected) managed types and native C++ objects. It's a "glue" language that is not intended for writing large amounts of code, but maybe it's worth nothing for this reason. --Mike Lin 19:33, 5 February 2006 (UTC)