Memory Corruption Issue??

Daniel Kozak via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 20 03:49:29 PST 2016


On Wednesday, 20 January 2016 at 09:12:57 UTC, Bottled Gin wrote:
> Greetings
>
> I am struggling with strange memory corruption issues with 
> dmd-2.069.2 release.
>
> ...
> ./main
> Start frop from C
> 0 -> @�+----------------
>
> The last line is the content of an array which is actually 
> filled with only dashes in the code.
>
> Kindly help. I want to make sure that I am not making a mistake 
> before I file a bug on dlang bugzilla.
>
> Regards
> - Puneet

Another workaround is to use GC.addRoot for dynamic allocated 
data in Dynamic.proc

void proc () {
     import core.memory: GC;
     dash.length = 32;
     GC.addRoot(cast(void*)dash.ptr);
     dash[] = '-';
}


More information about the Digitalmars-d mailing list