[Issue 19539] New: Interface address is offset 16bytes, causing memory leaks
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed Jan  2 20:22:10 UTC 2019
    
    
  
https://issues.dlang.org/show_bug.cgi?id=19539
          Issue ID: 19539
           Summary: Interface address is offset 16bytes, causing memory
                    leaks
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ihcuo21 at gmail.com
code example
-----------------------
import std.stdio;
import core.memory;
interface A {
        int func();
}
class AX : A {
        override int func() {
                return 1;
        }
        char[100] data;
}
void main() {
        AX ax = new AX;
        A a = ax;
        //the offset is 16 bytes
        writeln(cast(void*)ax);
        writeln(cast(void*)a);
        //delete will not free memory because "a" does not point to allocated
block
        __delete(a);
}
-----------------------
--
    
    
More information about the Digitalmars-d-bugs
mailing list