Cleaning/Releasing large arrays from memory
Clinton via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jul 24 11:23:36 PDT 2017
On Monday, 24 July 2017 at 18:01:19 UTC, ketmar wrote:
> Clinton wrote:
>
>> On Monday, 24 July 2017 at 14:51:04 UTC, rikki cattermole
>> wrote:
>>> Stuff the GC.
>>> You don't need it to care about collecting (or destroying for
>>> that matter).
>>>
>>> Tell it to free[0] the array directly.
>>>
>>> ```D
>>> T[] array;
>>>
>>> GC.free(array.ptr);
>>> ```
>>>
>>> Normally I would suggest to create your own buffer, but
>>> because of the DB library probably doesn't support that, no
>>> point trying to force it.
>>>
>>> [0] http://dlang.org/phobos/core_memory.html#.GC.free
>>
>> BTW, how would I do this with associative arrays?
>
> you can't. you can `.clear` 'em, though, but this won't
> immediately free the internal storage.
Meh.. Okay, well using these two should make things a lot better.
Thanks for the help and clearing up my confusion.
More information about the Digitalmars-d-learn
mailing list