A question regarding the GC

bearophile bearophileHUGS at lycos.com
Sun Jul 20 12:20:55 PDT 2008


Sean Kelly:
> Since the GC provides a method to obtain this information I believe that 
> implicit permission has been given to use the capacity indicated.  After 
> all, the GC wouldn't tell you about capacity it didn't want you to use :-)

I see.
(So far I have meant the capacity value as the higher value the GC can realloc the memory block until it needs to copy the block to a new position. I have meant it as little useful value. Now I'll find better ways to use it, the first usage will probably be in the implementation of a templeted unrolled linked list :-) ).

Related note: the std.c.malloc() too must store the size of the allocated block somewhere, but I presume such value can't be found in simple ways...

Bye and thank you,
bearophile


More information about the Digitalmars-d-learn mailing list