std.allocator needs your help

deadalnix deadalnix at gmail.com
Mon Sep 23 17:12:26 PDT 2013


On Monday, 23 September 2013 at 17:16:40 UTC, Andrei Alexandrescu 
wrote:
> The singleton allocator "it" is instrumental for supporting 
> stateful and stateless allocators with ease. It took me a few 
> iterations to get to that, and I'm very pleased with the 
> results. I think it would be difficult to improve on it without 
> making other parts more difficult.
>

The allocator can use a singleton internally without using "it". 
I'm unclear what is the problem solved.

>> What you call safe really isn't. Allocate something on the GC, 
>> store a
>> pointer on a custom allocated location, collect, enjoy the 
>> memory
>> corruption.
>
> I don't understand this. There are no pointers at this level, 
> only untyped memory. The main chance of corruption is to access 
> something after it's been freed.
>

If there are no pointers at this level, then the collect method 
do not make any sense.

>> Allocation can only be safe if the GRAND MASTER GC is aware of 
>> it.
>
> I don't think so.
>

When GRAND MASTER GC unhappy, he free live objects.


More information about the Digitalmars-d mailing list