Summary: Add ability to call element dtors to array blocks
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: druntime

--- Comment #0 from Steven Schveighoffer <> 2011-06-21 
05:04:39 PDT ---
Currently, when an array of structs is created on the heap, the destructor for
those structs is not called when the GC collects the memory block.  However,
this can be fixed by having the runtime store the typeinfo used to create the
block inside the block, along with a flag indicating a finalizer.

Proposed design:

lifetime.d:  Store the typeinfo reference in the last bytes of small blocks,
beside the length in large blocks.  If the typeinfo has no dtor, don't store
it.  If the typeinfo is stored, mark the block as containing a finalizer.

gcx.d: when finalizing a block that has both appendable and finalizer set, call
a lifetime.d function which finalizes the array (new function)

std.array: Appender should use the finalizer mechanism above to store the
typeinfo if necessary.  Not sure at this point how it will interact with array
runtime.  However, there are pending improvements for Appender that may make
this easier (see bug 5813).

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to