[D-runtime] Metadata for memory

Fawzi Mohamed fawzi at gmx.ch
Fri Jul 30 07:18:11 PDT 2010


> [...]
> I think the most funky situation is really the small blocks (16 or  
> 32 bytes)
> where you want overhead to be small, but you need to store enough  
> info.  With a
> 16-byte block, I think we can squeeze both the bitmask and length  
> into one
> byte.  Essentially 4 bits for length, and 3 bits for a bitmask (the  
> 4th word is
> incomplete, so only 3 bits are needed).  For a 32 byte block, we  
> would need 2
> bytes, one for the 7-bits bitmask, and one for the length.  At 64  
> bytes, we can
> have 16 bits for bitmask, and 1 byte for length.  At 128 bytes and  
> above, a
> bitmask would consist of 32 bits anyways, so might as well start  
> using a pointer
> (may be different for 64-bit CPUs), and still only a byte is needed  
> for length.

Especially in these cases external storage with a bitmap for the whole  
pool is advantageous.



More information about the D-runtime mailing list