On 1/9/13 1:11 PM, Tove wrote:
On Wednesday, 9 January 2013 at 20:16:04 UTC, Andrei Alexandrescu wrote:
On 1/9/13 12:09 PM, Mehrdad wrote:
It's memory-safe too. What am I missing here?

What you're missing is that you define a store that doesn't model
object references with object addresses. That's what I meant by
"references are part of the language". If store is modeled by actual
memory (i.e. accessing an object handle takes you to the object), you
must have GC for the language to be safe. If store is actually
indirected and gives up on the notion of address, then sure you can
implement safety checks. The thing is everybody wants for references
to model actual object addresses; indirect handles as the core
abstraction are uninteresting.


Andrei

Quote from OpenBSD's malloc implementation:
"On a call to free, memory is released and unmapped from the process
address space using munmap."

I don't see why this approach is less safe than a GC... in fact, I claim
it's safer, because it's far simpler to implement, and thus less likely
to contain bugs and in addition it's easy to make performance vs safety
trade-offs, simply by linking with another memory-allocator.

No. When you allocate again and remap memory, you may get the same address range for an object of different type.

Andrei

Reply via email to