std.expreimantal.allocator deallocate

vitamin vit at vit.vit
Mon Jan 25 10:09:22 UTC 2021


On Sunday, 24 January 2021 at 18:38:42 UTC, Petar Kirov 
[ZombineDev] wrote:
> On Sunday, 24 January 2021 at 14:56:25 UTC, Paul Backus wrote:
>> [...]
>
> To add to that, if an allocator defines 
> `resolveInternalPointer` [0][1] you could be able to get the 
> original slice that was allocated (and then pass that to 
> `deallocate`, but not all allocators define 
> `resolveInternalPointer` and also even if they do define it, 
> they're not required to maintain complete book-keeping as doing 
> so could have bad performance implications (i.e. calling say 
> `a.resolveInternalPointer(a.allocate(10)[3 .. 6].ptr, result)` 
> can return `Ternary.unknown`.
>
> [0]: 
> https://dlang.org/phobos/std_experimental_allocator.html#.IAllocator.resolveInternalPointer
> [1]: 
> https://dlang.org/phobos/std_experimental_allocator_building_blocks.html

Thanks


More information about the Digitalmars-d-learn mailing list