Are memory leaks considered to violate memory safety?

I am divided on this issue.

I just want to point out that I want a clear definition of what is meant by “memory leak” here. I.e., is a chain of Boxs, reachable from the stack but never read from, to be classified as a memory leak?

  • An experienced C++ or Java programmer would probably say “no, that is just bad coding: you should be ensuring that you free that memory.” And a Rust programmer would probably say the same thing.

  • But when you look at this from the point-of-view of the client of the badly behaved application or library, such a chain of Box's is indistinguishable from unsafe code that forgets to call free().

  • So what does it accomplish to treat the forgotten-free as a case of memory unsafety, but not the chain-of-boxes?

    • (The only advantage I can immediately see is that memory introspection tools (that e.g. trace objects the same way a GC would) might be far more helpful in debugging the chain-of-boxes than they would the forgotten-free.)