Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fundamentals to describe GC better #2530

Open
pyricau opened this issue Jun 1, 2023 · 0 comments
Open

Update fundamentals to describe GC better #2530

pyricau opened this issue Jun 1, 2023 · 0 comments

Comments

@pyricau
Copy link
Member

pyricau commented Jun 1, 2023

Reading this paper description: https://patents.google.com/patent/US6671707

Some of the descriptions are well worded and we should reuse those:

Java was derived from the C++ programming language. Java includes some other important features from garbage collected languages (e.g., Smalltalk and LISP)—including automatic memory storage management.

Garbage collected languages, such as Java, allow the system (garbage collector) to take over the burden of memory management from the programmer. When a program runs low on heap space, the garbage collector (GC) determines the set of objects that that program may still access. Objects in this set are known as live objects. The space used by objects that will no longer be accessed (“dead objects”) is freed by the garbage collector for future use. An object is defined as a collection of contiguous memory locations, lying in a single region that can be addressed and accessed via references.

There are many algorithms for performing garbage collection. All the algorithms start with a set of roots that enumerate all objects in the heap that are directly reachable. A root is a slot whose referent object (if any), is considered reachable, along with all objects transitively reachable from the referent. The remaining objects in the heap are unreachable and can be reclaimed.

A reference, also called a pointer, is the address of an object. Objects do not overlap and may be relocated independently of one another by the collector. In some cases, an object corresponds to a Java object. Multiple low-level objects may also be used to represent a single Java object. One example of this is a Java object with complex monitor locking happening. An object may contain slots, non-slot data, or both. A slot is a memory location that may contain a reference (pointer) to an object. A slot may also refer to no object, i.e., contain the null pointer. Memory locations can be categorized into slots and non-slot data correctly and unambiguously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant