www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14221] New: Investigate the impact of calling destructors

https://issues.dlang.org/show_bug.cgi?id=14221

          Issue ID: 14221
           Summary: Investigate the impact of calling destructors during
                    garbage collection
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: andrei erdani.com

Per http://forum.dlang.org/post/mchtl3$ccp$1 digitalmars.com, calling the
destructor of a struct member inside a class may do things like dereferencing a
counter. Currently destructors don't have special provisions for working from
multiple threads (e.g. File uses thread-local reference counting).

A possible approach is calling each destructor from the same thread that
created the object.

One possibility is we may deem the lapse benign, i.e. if a refcounted struct
has gotten all the way down to being collected, then a mistake in updating the
counter may at worst leave it for the next collection cycle.

--
Feb 24 2015