[Issue 10701] segfault in GC

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 23 06:07:36 PDT 2013


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


Maxim Fomin <maxim at maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|segfault after GC.realloc   |segfault in GC
           Severity|normal                      |critical


--- Comment #3 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-07-23 06:07:35 PDT ---
(In reply to comment #2)
> (In reply to comment #1)
> > Reduced:
> > [...]
> > Removing appender makes bug go away.
> 
> Nice.
> 
> Appender in itself isn't doing anything much. As long as an allocation occurs,
> any function will do:
> 
> //----
> string toStr(long src)
> {   
>     new int;
>     return "";
> }
> //----

Then futher reduced:

import core.memory;

extern(C) int printf(const char*, ...);

void readt()
{
    //ubyte[] result = new ubyte[](5000); //This works
    ubyte[] result; result.length = 5000; //But this fails
    GC.free(result.ptr); //works if commented out 
    result = null;
}

void main()
{
    foreach(i; 0 .. 1024)
    {
        foreach(e; 0 .. 1024)
        {
            new int;
        }

        readt();
    }
}

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


More information about the Digitalmars-d-bugs mailing list