20,741
edits
| Line 1: | Line 1: | ||
{{Stub}} | {{Stub}} | ||
Garbage collection is a common approach to automatic memory management in programming languages. In a garbage collector, the runtime system automatically identifies which objects are no longer in use by the program and reclaims the memory used by those objects. This can help prevent memory leaks and make it easier for programmers to manage memory in their programs. | |||
== mark/sweep GC == | == mark/sweep GC == | ||
A mark/sweep garbage collector is a type of automatic memory management system that is commonly used in programming languages that lack built-in support for garbage collection. The basic idea behind a mark/sweep garbage collector is to periodically scan through the program's memory and identify any blocks of memory that are no longer being used by the program. These blocks of memory, known as garbage, are then freed up for use by the program. | A mark/sweep garbage collector is a type of automatic memory management system that is commonly used in programming languages that lack built-in support for garbage collection. The basic idea behind a mark/sweep garbage collector is to periodically scan through the program's memory and identify any blocks of memory that are no longer being used by the program. These blocks of memory, known as garbage, are then freed up for use by the program. | ||