Skip to main content

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.

10 votes
2 answers
697 views

I am working on a new backend for a programming language using LLVM IR. This language makes a distinction between basic values and pointers to nodes on the heap, and uses a copying collector for ...
user65560's user avatar
  • 200
14 votes
3 answers
4k views

Modern operating systems usually use some of the main memory for caching files, as loading those files from the cache will be faster than loading them from disk; but this memory can be reclaimed by ...
kaya3's user avatar
  • 22.4k
8 votes
2 answers
755 views

Overview Ensuring memory safety is a core facet of modern programming language design. Memory safety can be guaranteed in many different ways. For the purposes of this question, I am defining memory ...
Wesley Jones's user avatar
3 votes
2 answers
627 views

I'm reading the GC Handbook and trying to implement the first collector type described there, a basic mark and sweep. I know this is not the greatest way to implement a garbage collector, but I want ...
Rob N's user avatar
  • 1,185
6 votes
3 answers
1k views

TL;DR: Could a programming language that uses manual memory management use a tracing GC to rescue the usual suspects of memory leaks? I was reading about the Boehm GC and came across this page that ...
Sudoh's user avatar
  • 163
4 votes
1 answer
1k views

Reference counting works best if there are no cycles. But closures that allow access to every variable in the parent scope by default automatically create cycles. There are obvious solutions like only ...
user23013's user avatar
  • 3,314
3 votes
2 answers
455 views

Awhile back I wrote a Rust implementation of the Monkey programming language by Thorsten Ball (https://monkeylang.org/). When I got done with it I was a bit surprised that I never used an Arc/Rc ...
lamont's user avatar
  • 139
7 votes
2 answers
792 views

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
  • 3,314
8 votes
4 answers
5k views

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
  • 191
17 votes
6 answers
4k views

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,185
27 votes
8 answers
7k views

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
  • 3,508
7 votes
3 answers
318 views

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's user avatar
  • 4,870
6 votes
2 answers
473 views

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
  • 3,508
9 votes
1 answer
684 views

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's user avatar
  • 4,870
22 votes
4 answers
4k views

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
  • 431

15 30 50 per page