www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - std.container.Array

reply "Casper =?UTF-8?B?RsOmcmdlbWFuZCI=?= <shorttail hotmail.com> writes:
Is there a good reason std.container.Array doesn't work with 
 nogc? The ddoc seems pretty explicit about its purpose:

Array type with deterministic control of memory. The memory 
allocated for the array is reclaimed as soon as possible; there 
is no reliance on the garbage collector. Array uses malloc and 
free for managing its own memory.
Sep 03 2014
parent reply "monarch_dodra" <monarchdodra gmail.com> writes:
On Wednesday, 3 September 2014 at 16:44:45 UTC, Casper Færgemand 
wrote:
 Is there a good reason std.container.Array doesn't work with 
  nogc? The ddoc seems pretty explicit about its purpose:

 Array type with deterministic control of memory. The memory 
 allocated for the array is reclaimed as soon as possible; there 
 is no reliance on the garbage collector. Array uses malloc and 
 free for managing its own memory.
Well, for starters, probably simply because we didn't take the right precautions to make it work. It should. I'll look into it. That said, keep in mind that Array only manages *its* objects. But when an Array has pointers, then it *will* tell the GC it holds indirections, and that it should be scanned in regards to the cleanup of *other* objects. Think Array!string.
Sep 03 2014
parent "Casper =?UTF-8?B?RsOmcmdlbWFuZCI=?= <shorttail hotmail.com> writes:
On Wednesday, 3 September 2014 at 17:05:26 UTC, monarch_dodra 
wrote:
 Well, for starters, probably simply because we didn't take the 
 right precautions to make it work. It should. I'll look into it.

 That said, keep in mind that Array only manages *its* objects. 
 But when an Array has pointers, then it *will* tell the GC it 
 holds indirections, and that it should be scanned in regards to 
 the cleanup of *other* objects. Think Array!string.
Thanks, I thought it might be an oversight.
Sep 03 2014