Re: Cleaning/Releasing large arrays from memory

2017-07-24 Thread Clinton via Digitalmars-d-learn
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;

Re: Cleaning/Releasing large arrays from memory

2017-07-24 Thread ketmar via Digitalmars-d-learn
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

Re: Cleaning/Releasing large arrays from memory

2017-07-24 Thread Clinton via Digitalmars-d-learn
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

Re: Cleaning/Releasing large arrays from memory

2017-07-24 Thread Clinton via Digitalmars-d-learn
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

Re: Cleaning/Releasing large arrays from memory

2017-07-24 Thread ketmar via Digitalmars-d-learn
rikki cattermole wrote: Tell it to free[0] the array directly. ```D T[] array; GC.free(array.ptr); or just `delete arr;`. it is marked as "deprecated" in changelog, but who cares? it works.

Re: Cleaning/Releasing large arrays from memory

2017-07-24 Thread rikki cattermole via Digitalmars-d-learn
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

Cleaning/Releasing large arrays from memory

2017-07-24 Thread Clinton via Digitalmars-d-learn
Hi guys, I have a question on how to free large arrays in D after they're no longer needed. Let's say I have this: SomeKey[] getKeys() { SomeKey[] n; foreach(batching stuff...) { SomeKey newstuff = db.select!(SomeKey[])(...); // gets around 6M of these from db