struct destructor

mw mingwu at gmail.com
Sun May 16 19:01:02 UTC 2021


On Sunday, 16 May 2021 at 11:42:19 UTC, Adam D. Ruppe wrote:
> On Sunday, 16 May 2021 at 08:04:06 UTC, cc wrote:
>> If the goal is to absolutely squeeze the GC back down after 
>> using new or dynamic arrays, I find destroy + GC.free often 
>> fails to do the trick (e.g. GC.stats.usedSize remains high).
>
> destroy + GC.free has a quirk - GC.free only works on what 
> GC.malloc returns, a base pointer, NOT what `new` returns. The 
> documentation says this but it is a subtle detail easy to 
> miss...

Right, we should always enforce malloc/free, new/delete are used 
in pairs, but not mixing them.

Un-deprecate `delete`?


More information about the Digitalmars-d-learn mailing list