How to do alligned allocation?

Steven Schveighoffer schveiguy at gmail.com
Sat Oct 1 14:49:43 UTC 2022


On 10/1/22 12:57 AM, tsbockman wrote:
> On Saturday, 1 October 2022 at 01:37:00 UTC, Steven Schveighoffer wrote:

>> The list of bit sizes is currently here:
> 
> I'm pretty sure those are in **bytes** not **bits**.

Yes, I meant bytes, sorry.

> 
> That's not a list of alignments, it is block sizes for some GC memory 
> pools. The alignment of each block depends on the alignment of its pool, 
> not just its size.

Pools are all page multiples. Each pool is split equally into bin sizes, 
from that list.

> Regardless, it's not part of the public API, so it could change without 
> warning.

Hence the "in practice" qualifier. Is it theoretically possible for a GC 
implementation to use smaller bin sizes, but it will never happen.

Consider that in small bins ( < 1 page ), no two bins are concatenated 
together. So if you had a bin of size 1, it means you would only 
allocate *one byte blocks*, never combining them.

Again, these are all implementation details, that likely will never change.

-Steve


More information about the Digitalmars-d-learn mailing list