[Issue 13558] New: GC.free does not work for array pointers of larger size

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Sep 30 09:01:06 PDT 2014


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

          Issue ID: 13558
           Summary: GC.free does not work for array pointers of larger
                    size
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: public at dicebot.lv

Original NG topic :
http://forum.dlang.org/post/uankmwjejsitmlmrbufe@forum.dlang.org

This code does not actually free anything:

```
void main()
{
    ubyte[] result;
    result.length = 4096;
    GC.free(result.ptr);
}
```

This happens because for larger size blocks capacity is stored in the beginning
of the memory block making actual `array.ptr` interior pointer. Interior
pointers are ignored by GC.free

There are several possible ways for fixing this that are being considered right
now.

--


More information about the Digitalmars-d-bugs mailing list