Issue 14221 - Investigate the impact of calling destructors during garbage collection
Summary: Investigate the impact of calling destructors during garbage collection
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Mac OS X
: P3 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-24 16:29 UTC by Andrei Alexandrescu
Modified: 2022-12-17 10:37 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrei Alexandrescu 2015-02-24 16:29:31 UTC
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.
Comment 1 Nick Treleaven 2015-02-24 17:31:14 UTC
Related: https://issues.dlang.org/show_bug.cgi?id=4624