www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12915] New: RedBlackTree leaks memory

https://issues.dlang.org/show_bug.cgi?id=12915

          Issue ID: 12915
           Summary: RedBlackTree leaks memory
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: schveiguy yahoo.com
          Reporter: code dawg.eu

We found this problem in a druntime GC benchmark.
https://github.com/D-Programming-Language/druntime/pull/818#issuecomment-46001787
It seems like the compiler inlines some functions and therefor a false pointer
to a stale node remains in a register or on the stack. Furthermore every
previously allocated node is referenced from that pointer.
I could resolve the issue by nulling _left, _right and _parent at the end of
Node.remove
(https://github.com/D-Programming-Language/phobos/blob/bb4f8e876b6278ad3b18d3ebb2f6597757b782f2/std/container.d#L5245),
but I don't understand enough of the implementation to be sure that this
doesn't break anything.

--
Jun 13 2014