Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the D programming language use an incremental garbage collector?

The page on the garbage collector doesn't specify whether D uses an incremental garbage collector or a stop-the-world version. It does mention pausing a few times, which could be a hint at a stop-the-world garbage collector, but I'm not sure.

If it doesn't use an incremental garbage collector, are there any particular reasons for this? A stop-the-world GC gives a hard time to interactive applications.

like image 959
orlp Avatar asked Mar 26 '12 14:03

orlp


People also ask

What programming languages use garbage collection?

Garbage collection (GC) is a memory recovery feature built into programming languages such as C# and Java.

Which programming language does not have garbage collection?

Primitive programming languages like C and C++ do not have their garbage collection instead expect the developer to not only allocate the object but also deallocate it explicitly.

Do all programming languages have garbage collection?

As said above, every programming language has their own way of performing GC. In C programming, developers need to take care of memory allocation and deallocation using malloc() and dealloc() functions. But, in the case of C# developers don't need to take care of GC and it's not recommended either.

Does Objective C use garbage collector?

Objective-C 2.0 adds garbage collection to the language as a replacement to the traditional retain / release reference counting scheme. Garbage collection is automatic object memory management.


1 Answers

Current implementations (Druntime) use a stop-the-world garbage collector, but the language itself doesn't place many restrictions on the details of an implementation.

There is a concurrent garbage collector for D, CDGC, for *nix-like OSes (it uses forking).

Incremental GCs are difficult to use in a compiled environment, because of the need of write barriers. VMs can track references, however system languages, which can call memcpy and similar functions, cannot.

like image 158
Vladimir Panteleev Avatar answered Oct 16 '22 22:10

Vladimir Panteleev