[OT] About GC: The Future of Rust : GC integration
deadalnix via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 7 21:34:52 PDT 2016
On Wednesday, 8 June 2016 at 04:15:17 UTC, H. S. Teoh wrote:
> I thought the usual implementation is to store the metadata
> immediately before the pointer, so it's O(1) to look it up.
>
No, it gets you terrible fragmentation and it makes it easy to
corrupt allocator data with just a buffer overflow/underflow,
which is a big nono.
But the general idea remain: the metadata address can indeed be
found in O(1) from the address of the data, usually with some
cheap bit twiddling, for most allocations (for instance, jemalloc
does it in O(1) fro all allocation < 256k and in log(n) for
larger ones).
More information about the Digitalmars-d
mailing list