August 25, 2019
The documentation for std.experimental.allocator is a little dense and I wanted to make sure I am understanding composition correctly.

Suppose I have the following, taken more-or-less direct from the docs:

    auto batchAllocator = AllocatorList!(
        (size_t n) => Region!Mallocator(max(n, 1024*1024))
    )();

https://dlang.org/phobos/std_experimental_allocator_building_blocks_region.html#.Region

Is my understanding correct that Mallocator, the ParentAllocator in Region's construction will allocate a block of at least 1 MiB when a request comes in, but calls to batchAllocator.make!(T) will allocate only enough (rounded up to some ideal like a power of 2) to store T -- until it runs out, then the AllocatorList will allocate another block of 1 MiB, and so on?

Essentially, I need to allocate memory for objects in an inner loop, and I thought a better strategy would be to make big block alloc(s) as a pool and then hand out internal pointers into the pool. I previously did this will malloc() and std.conv.emplace, but this looks like a better solution, if my understanding is correct.

Thank you!
August 27, 2019
On Monday, 26 August 2019 at 01:06:55 UTC, James Blachly wrote:
> The documentation for std.experimental.allocator is a little dense and I wanted to make sure I am understanding composition correctly.
>
> [...]

Yes, you are correct.

Edi