Re: [Gc] Determine the requested size of a memory block

Ivan Maidanski ivmai at
Thu Apr 22 00:43:57 PDT 2010

Thu, 22 Apr 2010 08:58:48 +0200 Christian Gudrian <christian at>:

> Hello!
> I would like to implement a length() function for an array.  GC_size 
> seemed perfect to do the job, however, it may return a larger size than 
> originally requested.  Is there a way to determine that size once the 
> memory has been allocated?  Or should I implement a dedicated array 
> allocation function which adds some meta data to the memory?
> Christian

The expected GC_size() usage is heap traversal and debugging. In theory, it's possible to adjust hb_sz (returned by GC_size) to have a byte granularity (with some negligible performance loss).


More information about the Gc mailing list