Home Segments Top Top Previous Next

13: Mainline

Java increases your productivity by providing automatic memory recycling. When you use a language such as C++, you have to remember to free the memory allocated to program elements, such as class instances, once you are finished with them. Failing to free memory produces a memory leak that may exhaust all the memory available to your program, leading either to erratic behavior or to a total program crash.

Java frees memory automatically, by performing automatic garbage collection, so you never need worry about memory leaks or waste time looking for one. Thus, you are more productive, and less likely to be driven crazy via tedious, mind-numbing debugging.

Most programming languages do not offer garbage collection, even though languages such as Lisp and Smalltalk established the great value of garbage collection decades ago.