www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11393] New: GC realloc and free don't ignore interior pointers

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11393

           Summary: GC realloc and free don't ignore interior pointers
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: nobody puremagic.com
        ReportedBy: safety0ff.bugz gmail.com


--- Comment #0 from safety0ff.bugz <safety0ff.bugz gmail.com> 2013-10-30
18:29:45 PDT ---
The documentation / spec [1][2] states that realloc and free should do nothing
when they're passed interior pointers.

Currently realloc / free still operate on the underlying memory blocks
regardless.

I started working on the fix for realloc but decided that it should really be
discussed before spending more time on it.

Discuss :)

----
[1] http://dlang.org/phobos/core_memory.html#.GC.realloc
[2] http://dlang.org/phobos/core_memory.html#.GC.free

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 30 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11393



--- Comment #1 from safety0ff.bugz <safety0ff.bugz gmail.com> 2013-10-30
18:41:25 PDT ---
I suppose this should have been spit into two bugs, but for now we can keep the
discussion focused.

The reason fixing realloc requires discussion is that fixing this may break
exiting code in the case where it is passed an interior pointer with a non zero
size parameter.

Fixing the case where the pointer is internal and either realloc is called with
size zero or free is called does not break existing code unless the GC is
disabled, where it will cause memory leaks.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 30 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11393



--- Comment #2 from safety0ff.bugz <safety0ff.bugz gmail.com> 2013-11-03
11:25:28 PST ---
Discussion thread:
http://forum.dlang.org/thread/qmiayckycycetnumulbn forum.dlang.org

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