Re: Dynamic arrays, emplace and GC

2016-07-05 Thread Rene Zwanenburg via Digitalmars-d-learn
On Tuesday, 5 July 2016 at 13:48:46 UTC, Claude wrote: Ah ok. I tried using void[size] static array and it seems to work without having to use GC.addRange(). Correct. void[] means the type of the data is unknown, so the GC has to assume it can contain pointers. This also means that _everythi

Re: Dynamic arrays, emplace and GC

2016-07-05 Thread Claude via Digitalmars-d-learn
On Tuesday, 5 July 2016 at 12:43:14 UTC, ketmar wrote: On Tuesday, 5 July 2016 at 10:04:05 UTC, Claude wrote: So here's my question: Is it normal??? yes. `ubyte` arrays by definition cannot hold pointers, so GC doesn't bother to scan 'em. Ah ok. I tried using void[size] static array and it

Re: Dynamic arrays, emplace and GC

2016-07-05 Thread ketmar via Digitalmars-d-learn
On Tuesday, 5 July 2016 at 10:04:05 UTC, Claude wrote: So here's my question: Is it normal??? yes. `ubyte` arrays by definition cannot hold pointers, so GC doesn't bother to scan 'em.

Dynamic arrays, emplace and GC

2016-07-05 Thread Claude via Digitalmars-d-learn
Hello, I've been working on some kind of allocator using a dynamic array as a memory pool. I used emplace to allocate class instances within that array, and I was surprised to see I had to use GC.addRange() to avoid the GC to destroy stuff referenced in that array. Here's a chunk of code[1]