Why many programmers don't like GC?
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Thu Jan 14 13:16:16 UTC 2021
On Thursday, 14 January 2021 at 13:10:14 UTC, sighoya wrote:
> On Thursday, 14 January 2021 at 13:08:06 UTC, Ola Fosheim
> Grøstad wrote:
>
>> Because Java has a well defined virtual machine with lots of
>> restrictions.
>
> So you're insisting this isn't possible in D?
It isn't possible in a meaningful way.
In system level programming languages you have to manually uphold
the invariants needed to not break the GC collection algorithm.
So if you change to a significantly different collection model,
the needed invariants will change.
The possible alternatives are:
1. Use "shared" to prevent GC allocated memory from entering
other threads and switch to thread local GC. Then use ARC for
shared.
2. Redefine language semantics/type system for a different GC
model. This will break existing code.
More information about the Digitalmars-d-learn
mailing list