www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9275] New: removeRoot hits assert(0) instead of being no-op (as documented)

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

           Summary: removeRoot hits assert(0) instead of being no-op (as
                    documented)
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: nobody puremagic.com
        ReportedBy: dmitry.olsh gmail.com


--- Comment #0 from Dmitry Olshansky <dmitry.olsh gmail.com> 2013-01-06
11:58:23 PST ---
Documentation clearly states that it's possible to call removeRoot on something
 that wasn't added by addRoot:

static nothrow void removeRoot(in void* p);

Removes the memory block referenced by p from an internal list of roots to be
scanned during a collection. If p is null or is not a value previously passed
to addRoot() then no operation is performed.

import core.memory;

void main()
{
 // this will work fine
    GC.removeRoot(null);
//this will boom once liner search fails to find '13' among roots
//It does the same with any sane pointer that isn't a root

    GC.removeRoot(cast(void*)13); 
}

Output:

object.Error: assert(0) or HLT instruction
----------------
0x0040BEB0
0x0040BD3B
0x770E30F1 in RtlRaiseStatus
0x770E30C3 in RtlRaiseStatus
0x770E2F2B in KiUserExceptionDispatcher
0x00403160
0x0040260E
0x00402211
0x00402034
0x76AF8543 in BaseThreadInitThunk
0x770FAC69 in RtlInitializeExceptionChain
0x770FAC3C in RtlInitializeExceptionChain
----------------

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