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



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



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



---

 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




 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




---


 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