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...
...including by other stdlib authors. __delete is simply
incorrectly implemented and an accidental no-op in most cases!
https://issues.dlang.org/show_bug.cgi?id=21550
The documentation that describes how to migrate away from
`delete` made this same error.
I tracked down the problem but wasn't 100% sure about the fix.
Adding the GC.baseOf thing works for me but i didn't upstream
since idk if it works for everyone else.
maybe i should just do it though.