How to destruct class instances allocated by a Region-allocator over a single GC block
rikki cattermole
rikki at cattermole.co.nz
Tue Apr 10 14:01:06 UTC 2018
On 11/04/2018 1:56 AM, Eduard Staniloiu wrote:
> On Monday, 9 April 2018 at 14:51:24 UTC, Per Nordlöw wrote:
>> On Monday, 9 April 2018 at 13:51:47 UTC, Steven Schveighoffer wrote:
>>> Well, you know the type, because make returned it no? The contract
>>> is, you call obj = make!X(args), then you have to call dispose(obj),
>>> where obj is of the type X. That's how it knows.
>>>
>>> If you are thinking you want to destroy the whole block at once
>>> (typed as void[]), that's not how it works.
>>>
>>> stdx.allocator is not going to help you with GC collection, it's not
>>> geared towards that purpose.
>>
>> Ok, thanks!
>
> If you are using a custom allocator to allocate memory then you also
> have to manually dispose of the memory when it is no longer needed.
>
> You can't have a custom allocator to supply you with the memory and
> then have the GC track and dispose of it. I get the feeling that this
> is what you were looking for?
As long as you can use libc's free, sure you can :)
More information about the Digitalmars-d-learn
mailing list