3 ms·
> The evidence does not support this assertion. What are you referring to? > C programs have a poor record of memory usage errors Right. The C language allow
by MaxBarraclough 6y ago
> The evidence does not support this assertion.
What are you referring to?
> C programs have a poor record of memory usage errors
Right. The C language allows for all manner of memory-related failures that are impossible in a language like Java. Use-after-free, double-free, and dereferencing NULL, are all undefined behaviour in C. In Java, the first two are impossible, and attempting to dereference null throws an exception. It's possible to do screwy things with Java finalisers, mind.
> the habit of Java programs routinely needing orders of magnitude more memory to do similar work is well known
Sure, but that's a matter of efficiency, with no bearing on memory safety.
> Memory leaks are as easy under GC as in C.
They're still possible, but I sincerely doubt they happen with equal frequency between the two languages. I don't know of a good study on this empirical question though.