How to destruct class instances allocated by a Region-allocator over a single GC block
Eduard Staniloiu
edi33416 at gmail.com
Tue Apr 10 13:56:59 UTC 2018
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?
More information about the Digitalmars-d-learn
mailing list