A question regarding the GC

bearophile bearophileHUGS at lycos.com
Sat Jul 19 18:12:19 PDT 2008


If I perform a std.gc.malloc(N), the Phobos GC gives me a pointer P, when I perform a std.gc.realloc(x, 0) it frees the memory, so the GC must remember how much N was (or probably its value rounded to the nearest larger multiple of 4, 8 or 16 bytes).
So given the pointer P, how can I ask the Phobos GC to quickly tell me how much N was? (and I'd like to know how much approximated such N' value is)
This will allow me to avoid saving that N value again into my data structures, avoiding wasting space to keep N two times in memory.
If the Phobos GC API is currently unable to give me this N' value and approximations, can't we modify the GC so it can give us such values?

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list