Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why is Garbage Collection A Good Thing?

collection garbage good thing
0
10 Posted

Why is Garbage Collection A Good Thing?

0

There are two entries on garbage collection, the first is an excellent entry written for the FAQ by Paul Johnson and the second is from the FAQ author’s company on the necessity of garbage collection for object-oriented programming and technique.

0

From: Paul Johnson (paj@gec-mrc.co.uk) Garbage collection (GC) is a facility in the run-time system associated with a language which will automatically reclaim objects which are no longer used. OO Languages which require garbage collection include Eiffel, Smalltalk and CLOS. C and C++ can have garbage collection retrofitted (see [3] and [4] below). [Ada has switchable GC, too -bob] Without GC programmers must explicitly deallocate dynamic storage when it is no longer needed (in C this is done by a call to free(3)). There are a number of problems with this: 1: Bugs due to errors in storage deallocation are very hard to find, although products are available which can help. 2: In some circumstances the decision about whether to deallocate storage cannot be made by the programmer. Drawing editors and interpreters often suffer from this. The usual result is that the programmer has to write an application-specific garbage collector. 3: An object which is responsible for deallocating storage

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.