[Issue 6188] New: Add ability to call element dtors to array blocks

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 21 05:09:26 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6188

           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
        AssignedTo: nobody at puremagic.com
        ReportedBy: schveiguy at yahoo.com


--- Comment #0 from Steven Schveighoffer <schveiguy at yahoo.com> 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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list