ssegvic
ssegvic

Reputation: 3142

Automatic memory management == garbage collection?

A friend is writing a book in a non-English language and has trouble translating garbage collection (GC). On the other hand, automatic memory management (AMM) translates very well.

The Wikipedia article on GC states that GC is a form of AMM. The same article also states that reference counting (RC) is a form of garbage collection. So, it would appear that we have AMM as a superset of GC, and GC as a superset of RC. However, there are many informal texts which use GC and AMM interchangeably. It therefore appears that one could safely say that AMM (also known as GC) has been realized either by identifying (un)reachable objects by tracing pointers or by relying on reference counts.

My question is: is there any AMM technique which could not be classified as GC? Or, equivalently, is the distinction between GC and AMM justified?

Please, feel free to comment on my wild guesses on AMM (GC) taxonomy :-)

Upvotes: 1

Views: 286

Answers (2)

Catfish_Man
Catfish_Man

Reputation: 41831

I think this is more a matter of common usage and reader expectation than precise definition. Sure, any automatic memory management technique "collects garbage", and therefore is a GC. In practice though, if you say "GC", people will assume you're referring to something with more specific properties (typically: nondeterministic finalization, automatic detection of unreferenced objects, ability to collect cycles), and get confused if you're not.

Upvotes: 1

Oliver Charlesworth
Oliver Charlesworth

Reputation: 272832

As is usually the case, there are no official definitions of these terms. But you could consider, for example, C++'s RAII idiom a form of automatic memory management. And it's quite distinct from reference-counting or garbage-collection.

Upvotes: 2

Related Questions