[Issue 6821] New: core.exception.OutOfMemoryError on dtor field test of class-embedded struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 16 20:38:20 PDT 2011


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

           Summary: core.exception.OutOfMemoryError on dtor field test of
                    class-embedded struct
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2011-10-16 20:37:24 PDT ---
struct Bar
{
    this(int x) {}

    uint _count;

    ~this()
    {
        assert(this._count > 0);
    }        
}

class Foo
{
    this()
    {
        bar = Bar(1);
    }

    Bar bar;
}

void main()
{
    auto foo = new Foo();
}

$ dmd test.d && test.exe
$ core.exception.OutOfMemoryError

The "assert(this._count > 0);" triggers this exception. I can only recreate
this if "bar" is a field of class Foo, and not just a temporary inside Foo's
constructor or anywhere else.

I'm labeling this as critical since these checks are prevalent throughout the
CairoD library and this seems like some kind of memory corruption issue.

I've also had this bug appear and disappear based on the current path of
invocation of an executable, IOW sometimes an app would throw this exception on
exit if it was invoked on a directory UP from the current application
directory, while in all other cases the exception would not be thrown.

-- 
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