Let's limit our focus to this problem alone. In the traditional approach addressing an object after it has been freed will produce an access violation. That is completely understandable. On the other hand if we address an object long after it was first instantiated a garbage collector will not complain, the program will keep on ticking because the memory has not been released.
Reflect on that for a few minutes.
I've reflected on this exactly 51.7 seconds, which is how long it took me to write this simple program:
procedure Test;
var sl1, sl2: TStringList;
begin
sl1 := TStringList.Create;
sl1.Add('Hello sl1');
sl1.Free;
sl2 := TStringList.Create;
sl2.Add('Hello sl2');
WriteLn(sl1.Text); // Use after free
end;
This clearly is a use after free, but guess what, no access violation, but infact it prints 'Hello sl2', which is not the text I have written into sl1. Again you demonstrate that you are discussing a topic you clearly have not much knowledge about.
It's a bit of a problem when using O/S APIs is considered "unsafe". If O/S services can't be used, it's going to be a challenge (mathematically impossible ?) to write a useful program.
You can embedd unsafe code within a safe class, where the Finalizers (Destructors) will call the unsafe free. This way when the class is freed, the unsafe code will also be freed. This is how already Microsoft embedds alot of WinAPI functionality into .Net classes, and if you do this you get the same provable guarantees even for the inherently unsafe code.
I cannot emit an opinion about Rust or even Java about their memory management features simply because I am not familiar enough with them but, at least in the case of Java, aside from leaving a lot to desire performance-wise which is likely in part due directly or indirectly to automatic memory management, I've noticed some rather "peculiar" behavior in some "professional" Java programs (some authored by Oracle itself.)
Manual memory management, when done correctly, leads to simplicity and superb performance, two characteristics I have not seen in any C# or Java program so far (but I admit, I have not spent a billion dollars doing research looking for that mythical unicorn.)
Rust has literally a net 0 performance impact, because all the memory safety computations are done at compiletime. No additional runtime code is required to get memory safety in rust.
And in your last sentence is the key: "Manual memory management, when done correctly,". The point is that you can't do it correctly. As I already shown examples of multiple times, memory management is one of the main driver for errors, and one of the severest problems in terms of security vulnerabilities.
If you could just do it correctly, no one would bat an eye, but the point is that thanks to the research we know that programmers, even extremely skilled programmers (as both Google and Mozilla only take the best of the best), just can't do it right.
If we would all write bug free programs, then C would be the optimal language, but it's not a good language, but it's not, because we do make mistakes, and C is very bad at preventing you from making mistakes. In a world where all programmers will make mistakes eventually a good language is a language that prevents them from happening
It would actually be hard to "shit on research" since, while you claimed there is research on the subject, you provided absolutely none. In your case, the best someone can do is shit on nothing.
Well I've already posted both the evaluation of Mozilla as well as of Google on the number of security critical (where Google found that 70% of their security critical bugs where memory errors).
And if you want to search some other sources, as I said there are mountains, the first one I've found comparing bugs between C++ and Java with analysis of types of errors is
https://www.lanl.gov/projects/CartaBlanca/webdocs/PhippsPaperOnJavaEfficiency.pdfThe main cause is most likely to be Java’s safe memory model. The hardest and most time consuming bugs to remove in C++ are those caused by bad pointers and other mistakes made in memory management. Java has eliminated these
errors, so it is not surprising that the mean time to fix bugs has dropped. The bug and defect forms did not include a separate category for memory problems, such problems were included in the heading ‘control flow’. In fact, 90 per cent of bugs were ‘control flow’, with ‘class
design’ and ‘method design’ each accounting for another 5 per cent. Therefore the study cannot definitively say that C++’s memory is the cause.
I know from one of our previous discussions how you stand to research, where I reviewed all the studies I could find on the maintainability of OOP vs procedural programs all coming to the same conclusion that OOP is improving maintainability, and all you responded was akin to "look at my hex editor". So I know this is just wasting my time. You don't care for the results of research when they contradict your personal (factually wrong) opinion.