August 05, 2011
@Kagamin

> What if
>
> foreach(i;0..512) {
>  append("/Users/dirList.txt", text("line ",i,'\n'));
> }

That works, but I misrepresented the problem and found that the following may be the issue (this looks more like the code im using):

import std.conv, std.stdio;

void main()
{
    string[] strArr;
    foreach(int i; 0 .. 257) {
        strArr ~= text("Line: " ~ to!string(i));
    }

    foreach(string e; strArr) {
        writeln(e);
    }
}

// OUTPUT for first 87 lines
Line: 2
?O
?O
`O
@O
 O

?N
?N
...
ect....
...
?@
?@
`@
0@

Line: 88
 /* rest of output is as expected */

Changing 257 to 256 gives you what you would expect.

Josh


August 06, 2011
Joshua Niehus Wrote:

> That works, but I misrepresented the problem and found that the following may be the issue (this looks more like the code im using):
> 
> import std.conv, std.stdio;
> 
> void main()
> {
>     string[] strArr;
>     foreach(int i; 0 .. 257) {
>         strArr ~= text("Line: " ~ to!string(i));
>     }
> 
>     foreach(string e; strArr) {
>         writeln(e);
>     }
> }

Looks like the described problem. 256 strings on 32-bit architecture is an array 2kb long. Move strArr to global scope and see if the code works. If the stack is not scanned by GC, that's bad.