A question regarding the GC

bearophile bearophileHUGS at lycos.com
Sun Jul 20 05:03:58 PDT 2008


torhu:
> Are you aware of std.gc.capacity()?

The docs say:
>uint capacity(void* p); Returns capacity (size of the memory block) that p points to the beginning of. If p does not point into the gc memory pool, or does not point to the beginning of an allocated memory block, 0 is returned.<

Is it safe to read/write all the bytes of such capacity (even if it's higher than the size of the requested memory block)?


> If you want to know what sizes the 
> GC rounds to when allocating, you probably need to read the source, 
> which comes with dmd.

Okay, but I think a constant property may be added to the GC API.

Thank you,
bye,
bearophile


More information about the Digitalmars-d-learn mailing list