std.allocator needs your help

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Sep 22 20:01:17 PDT 2013


On 9/22/13 7:45 PM, Brad Roberts wrote:
> I think the question he's asking, which a lot of people are anxiously
> anticipating is... how does the intersect with the parts of the language
> and core libraries that have been blocked (for a loose definition of
> blocked) waiting for the allocator design.  Primarily, but far from
> exclusively, the container library.
>
> Yes, the allocator design is clearly a lower level component, but it's
> also far easier than the integration with the language and libraries.

Containers and other objects that want to allow customization of their 
allocation would be parameterized during compilation with an allocator 
type. Functions that need to allocate memory may similarly accept a 
parameter of allocator type.

One possibility I'm keeping in mind is that of defining a dynamic 
interface (i.e. in the OOP sense) for a global allocator. Then people 
can globally change what allocator must be used for operator new 
invocations.

The work at the level described so far is quite orthogonal on these high 
level choices. Right now it's all about a statically-typed allocator 
that is good at allocating and deallocating octets.


Andrei



More information about the Digitalmars-d mailing list