www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8875] New: can't remove() in case of static associated array

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

           Summary: can't remove() in case of static associated array
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: hotcocoamix gmail.com


--- Comment #0 from hotcocoamix gmail.com 2012-10-22 20:37:40 PDT ---
example code ( no error ):

void main(){
    C c;
    c = new C(0);
    delete c;
}
class C{
    static int[int] staticList;
    int myint;

    this( int x ){
        staticList[x] = 1;
        myint = x;
    }
    ~this(){
        staticList.remove( myint );
    }
}

BUT comment out "delete c;" , freeze by end of runtime.

in addition,
code that only refer to staticList did'nt freeze.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 22 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8875


hotcocoamix gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|freeze in case of  remove() |core.exception.InvalidMemor
                   |in Destructors              |yOperationError in case of
                   |                            |remove() in Destructors


--- Comment #1 from hotcocoamix gmail.com 2012-10-25 15:36:03 PDT ---
core.exception.InvalidMemoryOperationError

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 25 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8875


Maxim Fomin <maxim maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |maxim maxim-fomin.ru
         Resolution|                            |INVALID


--- Comment #2 from Maxim Fomin <maxim maxim-fomin.ru> 2012-10-26 08:51:43 PDT
---
(In reply to comment #0)
 example code ( no error ):
 
 void main(){
     C c;
     c = new C(0);
     delete c;
 }
 class C{
     static int[int] staticList;
     int myint;
 
     this( int x ){
         staticList[x] = 1;
         myint = x;
     }
     ~this(){
         staticList.remove( myint );
     }
 }
 
 BUT comment out "delete c;" , freeze by end of runtime.
 
 in addition,
 code that only refer to staticList did'nt freeze.
AFAIK D garbage collector is non-reenterable. When a program returns from main function and GC collects objects, destructors should not perform gc-related operations because it will result in InvalidMemoryOperationError. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 26 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8875


hotcocoamix gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |FIXED


--- Comment #3 from hotcocoamix gmail.com 2012-10-26 15:32:00 PDT ---
(In reply to comment #2)
 AFAIK D garbage collector is non-reenterable. When a program returns from main
 function and GC collects objects, destructors should not perform gc-related
 operations because it will result in InvalidMemoryOperationError.
I think non-static destructor must be able to operate static member. so, GC must has more better Transfer of authority than if(running) . its possible ? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 26 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8875



--- Comment #4 from Maxim Fomin <maxim maxim-fomin.ru> 2012-10-26 22:40:36 PDT
---
(In reply to comment #3)
 (In reply to comment #2)
 AFAIK D garbage collector is non-reenterable. When a program returns from main
 function and GC collects objects, destructors should not perform gc-related
 operations because it will result in InvalidMemoryOperationError.
I think non-static destructor must be able to operate static member. so, GC must has more better Transfer of authority than if(running) . its possible ?
Whether data is static or not does not affect GC behavior on collecting garbage when main function exits. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 26 2012