Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Garbage collection (computer science)
(section)
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!
=== Advantages === {{Unreferenced section|date=April 2021}} GC frees the programmer from manually de-allocating memory. This helps avoid some kinds of [[bug (software)|error]]s:<ref>{{Cite web |title=Garbage Collection |url=https://rebelsky.cs.grinnell.edu/Courses/CS302/99S/Presentations/GC/ |access-date=2024-01-13 |website=rebelsky.cs.grinnell.edu}}</ref> * ''[[Dangling pointer]]s'', which occur when a piece of memory is freed while there are still [[pointer (computer programming)|pointer]]s to it, and one of those pointers is [[dereference operator|dereferenced]]. By then the memory may have been reassigned to another use, with unpredictable results.<ref>{{Cite web |last=Heller |first=Martin |date=2023-02-03 |title=What is garbage collection? Automated memory management for your programs |url=https://www.infoworld.com/article/3685493/what-is-garbage-collection-automated-memory-management-for-your-programs.html |access-date=2024-06-21 |website=InfoWorld |language=en}}</ref> * ''Double free bugs'', which occur when the program tries to free a region of memory that has already been freed, and perhaps already been allocated again. * Certain kinds of ''[[memory leak]]s'', in which a program fails to free memory occupied by objects that have become [[unreachable]], which can lead to memory exhaustion.<ref>{{Cite web|url=https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/fundamentals|title=Fundamentals of garbage collection {{!}} Microsoft Learn|author=[[Microsoft]]|date=28 February 2023 |access-date=2023-03-29}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)