A D vs. Rust example
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Wed Oct 26 22:09:46 UTC 2022
On Wednesday, 26 October 2022 at 21:17:01 UTC, Don Allen wrote:
> And are you aware that when and if there is a real-time
> requirement, you can turn off the GC?
Turning off the GC is not an option that will work out as there
is no period of time that isn't "realtime", but you can keep GC
managed objects on a separate thread. That approach only makes
sense if you can separate out and shield significant work
suitable for GC from the other work that has to be done.
For the most part using owning pointers and arenas is a more
flexible approach if you cannot use a generic GC for most of your
program. Browsers do use a GC for resources that are "owned" by
javascript, but the browser code then have full control over the
collection strategy. That is not the case for a generic
run-of-the-
mill language solution.
The moment you have to micromanage a large number of objects by
pinning and unpinning them because they are leaving the GC
context you might find that the benefits of using a managed
solution is lost. So the overall complexity goes down with
choosing something more homogeneous (like owning pointers).
More information about the Digitalmars-d
mailing list