Allocation strategies question

Rikki Cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 29 22:21:09 PDT 2015


On 30/10/15 5:27 PM, ref2401 wrote:
> On Friday, 30 October 2015 at 04:11:05 UTC, ref2401 wrote:
>> It would be greate if compiler were able to use `theAllocator` and
>> `processAllocator` but they don't seem much helpfull. Terrible naming
>> by the way.
>
> I should have suggested different names if don't like present ones.
> if `processAllocator` stands for the whole process then there must be
> `threadAllocator` as well. But that's not the question.
> I would like to know about usage strategies of various allocators within
> the same code.

What I normally do for memory to be owned by the thread is:

auto foo(IAllocator alloc=theAllocator()) {...}

Where as for if it is global to the process:

auto foo(IAllocator alloc=processAllocator()) {...}

Basically it is the difference between a screenshot of a display and a 
window instance.


More information about the Digitalmars-d-learn mailing list