Re: How to make AA key a pointer

2018-02-20 Thread Clinton via Digitalmars-d-learn
On Monday, 19 February 2018 at 15:02:29 UTC, ketmar wrote: Clinton wrote: On Monday, 19 February 2018 at 14:55:01 UTC, Clinton wrote: [...] Sorry, on second look my explanation isn't very clear. I want to know if: bool[string] myAA; myAA[contact.id] = true; // Does this copy contact.id

Re: How to make AA key a pointer

2018-02-19 Thread Clinton via Digitalmars-d-learn
On Monday, 19 February 2018 at 14:55:01 UTC, Clinton wrote: Hi all, I need advice from better developers on this concern. I'm using an AA to reference another array for quicker access: [...] Sorry, on second look my explanation isn't very clear. I want to know if: bool[string] myAA;

How to make AA key a pointer

2018-02-19 Thread Clinton via Digitalmars-d-learn
Hi all, I need advice from better developers on this concern. I'm using an AA to reference another array for quicker access: [code] alias contactId = string; bool[contactId][] matches; ulong[contactId] idsToMatches; bool[string] matchesForId(string id) { return matches.get(idsToMatches[id],

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 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

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