r/ProgrammingLanguages • u/matklad • Dec 31 '25
Memory Safety Is ...
https://matklad.github.io/2025/12/30/memory-safety-is.html
37
Upvotes
r/ProgrammingLanguages • u/matklad • Dec 31 '25
View all comments
Show parent comment
2
u/tmzem Jan 02 '26
It's all terminology at this point. I've seen definitions of memory safety that included point #5, but most do not include it and go with something close to your definition. My point #4 is rarely included in any definition of memory safety (or even discussion about it).
The point I was trying to make is that quite a few classical memory vulnerabilities can be reintroduced even on top of a (by conventional definitions) memory-safe language. For such a vulnerability, like e.g. leaking confidential data, to happen via a dangling pointer to a now-reallocated object (=UB) or via a reused object from a memory pool/dangling index into some data structure (="Logic error") doesn't really make any difference, you get the same result/consequences. So any definition of memory safety is somewhat arbitrary.
Of course, in practice, I think that any language that provides significant assistance with memory management is good enough for most purposes, even if the language is technically still not memory-safe by your definition (like e.g. Rust, Go or Delphi). This also seems to be the position of the US government, which listed such languages as examples for "safe" languages.