From https://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29%|%Wikipedia%|% :
"In computer science, garbage collection (GC) is a form of automatic memory management. The garbage collector, or just collector, attempts to reclaim garbage, or memory occupied by objects that are no longer in use by the program. Garbage collection was invented by John McCarthy around 1959 to solve problems in Lisp."
Java programmers may never have to worry about memory management, because the JVM includes garbage collection. However, when the JVM performs garbage collection it can stop-the-world, and can also consume a significant amount of processor cycles. As a result the JVM offers several types of GC, and also the GCs can be fine tuned to suit the needs of an application and the hardware it's running on. With GC, memory management can occasionally change from not being on the horizon to quite a difficult problem to solve.
For more details on Java GC, see here .
Strong/Weak references are an alternative to GC. The programmer has to do a bit of work to manage memory, but they're relatively easy to use, and don't have the problems associated with GC. Also from https://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29%|%Wikipedia%|% :
"While the Objective-C traditionally had no garbage collection, with the release of OS X 10.5 in 2007 Apple introduced garbage collection for Objective-C 2.0, using an in-house developed runtime collector. However, with the 2012 release of OS X 10.8, garbage collection was deprecated in favor of LLVM's automatic reference counter (ARC) that was introduced with OS X 10.7. Furthermore, since May 2015 Apple even forbids the usage of garbage collection for new OS X applications in the App Store. For the iOS, garbage collection has never been introduced due to problems in application responsivity and performance; instead, iOS uses ARC."
See here for a good description of ARC and strong/weak references for the Swift programming language.
For Tcl versions of the Swift examples, see Playing Strong/Weak References.