On Saturday, 14 January 2017 at 15:30:42 UTC, Rainer Schuetze
wrote:
In addition, you need to lookup the pool anyway to figure out
if the pointer points to non-managed memory (stack, global
data, malloc'd memory).
Makes me wonder about a GC'd language where each pointer is
actually a member of a struct which also has a base allocation
pointer. The base pointer could either only be set for managed
allocations, or the low bit of the base address could be used to
indicate such instead*. This would make for faster GC scans, but
would also cause slowdowns when copying pointers. Pointer
arithmetic would be just as efficient though.
(*) With this scheme, pointer arithmetic can be @safe in assert
mode.