12 ms·
> As you just said, increased security is from taking pointers away, which is completely orthogonal to GC. That's not what he said. Removing pointer arithmetic
by rbehrends 13y ago
> As you just said, increased security is from taking pointers away, which is completely orthogonal to GC.
That's not what he said. Removing pointer arithmetic [1] is part of getting memory safety, but not the entire story. Avoiding dangling references is another part of memory safety, and GC is one way to accomplish that; it's not orthogonal.
[1] You cannot actually eliminate pointers entirely; you can disguise them, but if you want a dynamic heap and not just static memory, you need to be able to reference memory within the heap. When people talk about eliminating pointers, they generally mean unsafe C-style pointers.
- Arelius 13y ago> Avoiding dangling references is another part of memory safety, and GC is one way to accomplish that; it's not orthogonal. It's the removal of the `free` and `delete` semantics that avoid dangling references. Not GC. While GC posits a good alternative to many of these problems. GC doesn't actually help memory safety at all. Unless you consider memory leaks to be a matter of "memory safety".
- rbehrends 13y agoAvoiding premature free()s is precisely what garbage collection accomplishes in this context, because you will never have to call free() to avoid running out of memory.