[Issue 10701] segfault after GC.realloc

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 23 05:05:09 PDT 2013


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



--- Comment #2 from monarchdodra at gmail.com 2013-07-23 05:04:48 PDT ---
(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 "";
}
//----

EG:
//----
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);
    result = null;
}

string toStr(long src)
{   
    new int;
    return "";
}

void main()
{
    foreach(int i; 0 .. 1024)
    {
        printf("Step: %d\n", i);
        string corruptme = "./temp";
        foreach(e; 0 .. 256)
        {
            corruptme ~= toStr(1);
        }
        readt();
    }
}
//----

This still preserves the "This works/But this fails" issue. Cores on iteration
255 (adding more "new int" will divide that number by the amount of "new")

-- 
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