6 ms·
I don't think any GC scheme could work with that. Languages that allow pointer arithmetic like that basically can't be GC'd. The problem with an imprecise GC i
by smanek 14y ago
I don't think any GC scheme could work with that. Languages that allow pointer arithmetic like that basically can't be GC'd.
The problem with an imprecise GC is that having an integer that looks like a pointer, could prevent an object from being freed.
- pcwalton 14y agoAlmost — C# has a cool feature whereby you can do pointer arithmetic if you pin the objects in question first, so the GC won't collect or move them. (The language statically enforces this by forbidding you from taking the address of a value until you pin it.)
- derleth 14y agoThat's cool; I think another way of doing it is to allow programs to request a sandbox where the GC doesn't go so they can do all of the pointer-arithmeticking they want as long as all their pointers fall within the sandbox by the time they're written through or dereferenced.
- deleted 14y ago[deleted]