Questions tagged [garbage-collection]

For questions about garbage collection within the scope of designing/implementing a programming language, including implementing garbage collectors, the semantics or behavior of garbage collection algorithms, and language features exposing garbage collection to the programmer.

Filter by
Sorted by
Tagged with
3 votes
1 answer
127 views

When do functional programming languages need advanced garbage collection?

While thinking about garbage collection, I realized a simple fact that a garbage collector that is more than reference counting is needed because there are circular references, but there are ...
user23013's user avatar
  • 2,260
5 votes
4 answers
3k views

Creating a new language with Rust without Garbage Collection?

I am new to language development. I am aware of Rust's ownership model that builds programs in a way that does not need garbage collection. So if I am to build a new programming language using safe ...
M4X_'s user avatar
  • 153
16 votes
6 answers
3k views

Possible to mix garbage collection and manual memory management?

Do you think it is possible to have a language that uses garbage collection (GC) by default, but allows you take more control with manual memory management like C++ or Rust, in areas of the software ...
Rob N's user avatar
  • 1,073
25 votes
8 answers
6k views

Is it possible to make GC a library?

Motivation Garbage collection is a critical component of memory management in many programming languages. Many languages have built-in garbage collectors tightly integrated into their runtime ...
Aster's user avatar
  • 2,733
7 votes
3 answers
180 views

What are the pros and cons of different ways of forcing resources to be closed properly?

There are various external resources, like file handles, TCP connections, and various servers, which need to be closed in some specific way before being dropped. There are a few approaches to these ...
Rydwolf Programs's user avatar
5 votes
2 answers
311 views

How to find the updated address of an object in a moving garbage collector?

I'm implementing a moving garbage collection algorithm, but I don't know how the GC can find an object's address after it has been moved. I thought of 3 options: Forwarding Pointer The first way is to ...
Aster's user avatar
  • 2,733
8 votes
1 answer
277 views

How does the performance of reference counting and tracing GC compare?

We already have a more general question about different types of garbage collection, but performance is only touched on briefly, and in pretty unspecific ways. What are the more specific ways in which ...
Rydwolf Programs's user avatar
20 votes
4 answers
3k views

How do precise garbage collectors find roots in the stack?

I know some garbage collectors (conservative GC) treat every word in the stack as a potential pointer to a live object in the heap (provided that the word actually points to somewhere inside an ...
Jeremy's user avatar
  • 411
24 votes
5 answers
683 views

Can "no cyclic data structures" be enforced at compile time?

When using reference counting for garbage collection, memory leaks can occur when cyclic structures are created (an object which contains a pointer to itself, or a pointer to an object with a pointer ...
Rydwolf Programs's user avatar
28 votes
4 answers
792 views

What different types of garbage collection are there, and what benefits do they provide?

Generally speaking, higher-level programming languages seem to utilize garbage collection. As a first example, Python uses reference counting (as well as three-level generational collection that just ...
Spevacus's user avatar
  • 615