On Wednesday, 28 May 2014 at 18:14:28 UTC, Walter Bright wrote:



After watching Adam's most excellent presentation at Dconf, I'm sure the book will be great! My copy gets here on Friday.

A question(s) regarding Chapter 5: Making a reference-counted object:

(btw do we need separate thread for content-related questions?)

- point 5 (of How to do it...) says: "... and free the object if necessary", but then in code:

~this() {
  if(data is null) return;
  writeln("Released. Refcount = ", data.refcount);
  if(data.refcount == 0)

is actual freeing missing? Or am I missing something?

Later in same chapter: "... or being collected by the garbage collector—its destructor is called, if present."

Is that really true? My understanding (and unfortunate test) is that it is never guaranteed that d-tor of GD allocated object is ever called. If that is the case then: is that true that dynamic array of RefCountedObject does not guarantee any of d-tors called? That would also mean that if any of objects in object graph is GC-allocated then NONE of its child nodes have any guarantees about destruction?

Reply via email to