I disagree. We still haven't succeeded in making memory safety considered a base foundation. People are still making new languages that aren't memory safe, and they're getting popular.
Conversation
I hesitate to even opine on this topic as it seems hotly debated and I don’t really know anything about Nim, but I’ve seen this mentioned in the past github.com/nim-lang/Nim/w
2
1
C and C++ can't be made memory safe with sanitizers. ASan only reliably detects linear overflows, not an arbitrary read/write from one object into another. A production implementation of even inter-object bounds safety for C is unavailable let alone temporal safety support.
1
3
ASan relies on tracking which memory is in use with a shadow map representing chunks of memory with bits and has redzones around objects along with a quarantine for recently freed memory limited by how much memory you're willing to burn on it.
1
3
It would be really cool if Clang had a switch to enforce memory safety but doing it efficiently and accurately likely requires having 128-bit or larger pointers which means having a different ABI. It could probably be done with ~30% performance overhead + fat ptr memory overhead.
Also, it'd only really be inter-object bounds + temporal safety. It's impractical to do it intra-object because too much is permitted especially for memcpy, etc. Also still lots of holes and it'd require fixing a lot of UB / implementation-defined assumptions, etc. to use it.
1
right, i think i accidentally inched my internal model closer to "strict C VM" (Sulong comes to mind) than to "Valgrind memcheck, but in your compiler", but that's indeed not really feasible if you're mixing with code that doesn't run under it
1
that said, my intention was to describe Nim's unsafety in terms of the C primitives it uses—it certainly seems to permit use-after-free of stack references (nim-lang.org/docs/manual.ht), and pointer arithmetic (although rarely used), presumably w/o bounds safety
1
Yeah, to me the interesting question is how much perf overhead do you have before it's more expensive than just using a conservative tracing GC.
2
6
Nix (an admittedly deeply cursed C++ codebase) uses Boehm, and it's fairly easy to cause use-after-frees in it by not rooting stuff correctly :(
2
4
Show replies



