www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6818] New: Globally shared class instances are never released

reply d-bugmail puremagic.com writes:
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



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: -------
Oct 16 2011
parent d-bugmail puremagic.com writes:
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



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: -------
Jan 29 2012