View mode: basic / threaded / horizontal-split · Log in · Help
October 16, 2011
[Issue 6818] New: Globally shared class instances are never released
http://d.puremagic.com/issues/show_bug.cgi?id=6818

          Summary: Globally shared class instances are never released
          Product: D
          Version: D2
         Platform: Other
       OS/Version: Windows
           Status: NEW
         Severity: major
         Priority: P2
        Component: DMD
       AssignedTo: nobody@puremagic.com
       ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-10-16 15:24:07 PDT ---
import std.stdio;
__gshared Foo foo;
class Foo
{
   ~this() { writeln("Release Foo"); }
}
void main() { foo = new Foo; }

OTOH the dtor gets properly called if it's a thread-local instance.
Is this a known bug?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 30, 2012
[Issue 6818] Globally shared class instances are never released
http://d.puremagic.com/issues/show_bug.cgi?id=6818


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

          What    |Removed                     |Added
----------------------------------------------------------------------------
            Status|NEW                         |RESOLVED
        Resolution|                            |INVALID


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-01-29 20:37:19 PST ---
__gshared variables go into the data segment (.BSS), and according to the docs:
"Objects referenced from the data segment never get collected by the gc."
(http://dlang.org/class.html).

TLS class objects go to the .tls section and get collected.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home