www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3719] New: forward references can cause out-of-memory error

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3719

           Summary: forward references can cause out-of-memory error
           Product: D
           Version: 2.039
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: patch
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: r.sagitario gmx.de



PST ---
If there are forward references that are not resolved for a long time, dmd can
waste a lot of memory and cpu-cycles. 

It's not easy to create a small test case, but qtd fails to compile with "out
of memory" without the following patch:

Module::runDeferredSemantic() should not retry between every new symbol in a
class or struct, but only when some sensible progress is made (e.g. if
Module::dprogress > 0). runDeferredSemantic() must then be forced to run once
before running semantic2() on the modules.


Index: mars.c
===================================================================
--- mars.c    (revision 336)
+++ mars.c    (working copy)
   -1109,6 +1109,12   
     if (global.errors)
     fatal();

+    if(modules.dim)
+    {   // last chance to resolve deferred symbols
+    Module::dprogress = 1;
+    ((Module *)modules.data[0])->runDeferredSemantic(); // should be static
instead
+    }
+
     // Do pass 2 semantic analysis
     for (i = 0; i < modules.dim; i++)
     {
Index: module.c
===================================================================
--- module.c    (revision 336)
+++ module.c    (working copy)
   -938,6 +938,8   
 {
     size_t len;

+    if(dprogress == 0)
+    return;
     static int nested;
     if (nested)
     return;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 18 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3719


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



18:52:34 PST ---
Changeset 342

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 19 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3719


Walter Bright <bugzilla digitalmars.com> changed:

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



22:41:54 PST ---
fixed dmd 1.056 and 2.040

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 30 2010