Hardcoding the optimal resource reclamation strategy into your program will always be more efficient at runtime than not doing so. What “real-time” garbage collection gives you is only freedom from arbitrarily long pauses, not closeness to the optimal strategy. Furthermore, it doesn't come for free: it imposes some memory usage overhead. Finally, garbage collection simply can't handle resources that need to be reclaimed in a deterministic fashion, like file handles, GUI objects and network connections.
That depends on what you mean by efficient. Since this thread is about real-time stuff, you may be right (though I wouldn't be on it). However, often a GC will give better throughput.
It depends on the style of memory management on both sides, of course. But for example, in a situation where you call `free` (or, `delete`, etc.) to free each allocation, you might end up doing more work than a copying GC, where you only have to track live references.
And note that I'm not talking about ability to serve soft real-time services where you're allowed between 1 to 5% of all transactions to miss their deadline. Do that for a car break system or for an airplane guidance system and lives are lost. Heck, do that for video decoding and frames are dropped.
http://www.jopdesign.com/doc/nbgc.pdf
https://www.usenix.org/legacy/events/vee05/full_papers/p46-c...
http://www.cse.buffalo.edu/~lziarek/euro.pdf
http://www.aicas.com/papers/ismm02f-siebert.pdf
So, there's some examples to work with. There's plenty more, too. Just search Google with terms "concurrent," "real-time," and "GC." Or "pauseless" replacing "concurrent." Or "hard" before "real-time." That combo is how I track them.
Successful multiprocessing frameworks are, in a modern sense, indistinguishable from networked peer-to-peer systems. While this space is well explored, it's very difficult to call the resulting discipline "easy." Just like threaded programming, it's easy to make something subtly wrong.
> Rust and Ocaml are very different programming languages. Rust does not have a GC and that changes its nature completely. For example Rust could be used for real-time systems where garbage collected languages would struggle.
Surveying the field, real time garbage collection is not a pipe dream. It's a delivered and purchasable reality. Propagating the myth that only direct memory management can possibly deliver good results is ignoring the last 15 years of hard work on the subject, as well as products in the field.
You're propagating a sort of urban legend. Please reconsider it.