Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Garbage collection (computer science)
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Availability == Generally speaking, [[high-level programming language|higher-level programming language]]s are more likely to have garbage collection as a standard feature. In some languages lacking built-in garbage collection, it can be added through a library, as with the [[Boehm garbage collector]] for C and C++. Most [[functional programming language]]s, such as [[ML (programming language)|ML]], [[Haskell]], and [[APL (programming language)|APL]], have garbage collection built in. [[Lisp (programming language)|Lisp]] is especially notable as both the first [[functional programming language]] and the first language to introduce garbage collection.<ref name="Chisnall_2011"/> Other dynamic languages, such as [[Ruby (programming language)|Ruby]] and [[Julia (programming language)|Julia]] (but not [[Perl]] 5 or [[PHP]] before version 5.3,<ref name="PHP"/> which both use reference counting), [[JavaScript]] and [[ECMAScript]] also tend to use GC. [[Object-oriented programming]] languages such as [[Smalltalk]], [[Object REXX|ooRexx]], [[RPL (programming language)|RPL]] and [[Java (programming language)|Java]] usually provide integrated garbage collection. Notable exceptions are [[C++]] and [[Delphi (programming language)|Delphi]], which have [[Destructor (computer programming)|destructor]]s. === BASIC === [[BASIC]] and [[Logo (programming language)|Logo]] have often used garbage collection for variable-length data types, such as strings and lists, so as not to burden programmers with memory management details. On the [[Altair 8800]], programs with many string variables and little string space could cause long pauses due to garbage collection.<ref name="MITS_1977"/> Similarly the [[Applesoft BASIC]] interpreter's garbage collection algorithm repeatedly scans the string descriptors for the string having the highest address in order to compact it toward high memory, resulting in [[Big O notation|<math>O(n^2)</math>]] performance<ref name="Hacker"/> and pauses anywhere from a few seconds to a few minutes.<ref name="Little_1985"/> A replacement garbage collector for Applesoft BASIC by [[Randy Wigginton]] identifies a group of strings in every pass over the heap, reducing collection time dramatically.<ref name="Fast_1981"/> BASIC.SYSTEM, released with [[ProDOS]] in 1983, provides a windowing garbage collector for BASIC that is many times faster.<ref name="Worth_1984"/> === Objective-C === While the [[Objective-C]] traditionally had no garbage collection, with the release of [[OS X 10.5]] in 2007 [[Apple Inc.|Apple]] introduced garbage collection for [[Objective-C]] 2.0, using an in-house developed runtime collector.<ref name="Leopard"/> However, with the 2012 release of [[OS X 10.8]], garbage collection was deprecated in favor of [[LLVM]]'s [[Automatic Reference Counting|automatic reference counter]] (ARC) that was introduced with [[OS X 10.7]].<ref name="Siracusa_2011"/> Furthermore, since May 2015 Apple even forbade the usage of garbage collection for new OS X applications in the [[App Store (iOS)|App Store]].<ref name="Appleinsider_2015"/><ref name="Cichon_2015"/> For [[iOS]], garbage collection has never been introduced due to problems in application responsivity and performance;<ref name="wwdc_2011"/><ref name="Silva_2014"/> instead, iOS uses ARC.<ref name="Napier-Kumar_2012"/><ref name="Cruz_2012"/> === Limited environments === Garbage collection is rarely used on [[embedded computing|embedded]] or real-time systems because of the usual need for very tight control over the use of limited resources. However, garbage collectors compatible with many limited environments have been developed.<ref name="Fu-Hauser_2005"/> The Microsoft [[.NET Micro Framework]], .NET nanoFramework<ref name="nanoframework"/> and [[Java Platform, Micro Edition]] are embedded software platforms that, like their larger cousins, include garbage collection. === Java === {{main|Java virtual machine#Garbage collectors}} Garbage collectors available in [[Java (software platform)|Java]] [[OpenJDK]]s virtual machine (JVM) include: * Serial * Parallel * [[Concurrent mark sweep collector|CMS]] (Concurrent Mark Sweep) * [[Garbage-first collector|G1]] (Garbage-First) * ZGC (Z Garbage Collector) * Epsilon * Shenandoah * GenZGC (Generational ZGC) * GenShen (Generational Shenandoah) * IBM Metronome (only in [[IBM]] OpenJDK) * SAP (only in [[SAP]] OpenJDK) * Azul C4 (Continuously Concurrent Compacting Collector)<ref name="Tene-Iyengar-Wolf_2011"/> (only in [[Azul Systems]] OpenJDK) === Compile-time use === Compile-time garbage collection is a form of [[static program analysis|static analysis]] allowing memory to be reused and reclaimed based on invariants known during compilation. This form of garbage collection has been studied in the [[Mercury (programming language)|Mercury programming language]],<ref name="Mazur_2004"/> and it saw greater usage with the introduction of [[LLVM]]'s [[Automatic Reference Counting|automatic reference counter]] (ARC) into Apple's ecosystem (iOS and OS X) in 2011.<ref name="Napier-Kumar_2012"/><ref name="Cruz_2012"/><ref name="Appleinsider_2015"/> === Real-time systems === Incremental, concurrent, and real-time garbage collectors have been developed, for example by [[Henry Baker (computer scientist)|Henry Baker]] and by [[Henry Lieberman]].<ref name="Huelsbergen-Winterbottom_1998"/><ref name="IECC-GC"/><ref name="Lieberman-Hewitt_1983"/> In Baker's algorithm, the allocation is done in either half of a single region of memory. When it becomes half full, a garbage collection is performed which moves the live objects into the other half and the remaining objects are implicitly deallocated. The running program (the 'mutator') has to check that any object it references is in the correct half, and if not move it across, while a background task is finding all of the objects.<ref name="Baker_1978"/> [[Tracing garbage collection#Generational GC (ephemeral GC)|Generational garbage collection]] schemes are based on the empirical observation that most objects die young. In generational garbage collection, two or more allocation regions (generations) are kept, which are kept separate based on the object's age. New objects are created in the "young" generation that is regularly collected, and when a generation is full, the objects that are still referenced from older regions are copied into the next oldest generation. Occasionally a full scan is performed. Some [[high-level language computer architecture]]s include hardware support for real-time garbage collection. Most implementations of real-time garbage collectors use [[tracing garbage collection#Real-time garbage collection|tracing]].{{Citation needed|date=September 2019}} Such real-time garbage collectors meet [[hard real-time]] constraints when used with a real-time operating system.<ref name="McCloskey_2008"/>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Garbage collection (computer science)
(section)
Add topic