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

           Summary: std.file.read on OSX: "Memory allocation failed"
           Product: D
           Version: 2.032
          Platform: x86_64
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nob...@puremagic.com
        ReportedBy: michel.for...@michelf.com


In almost all cases, calling std.file.read a second time I throws a "Memory
Allocation Failed" error and the program exits. This simple program (that
prints itself) fails on my OS X machine at the second call to read.

import std.file : read;
import std.stdio : writeln;

int main(string[] args)
{
    scope(success) writeln("Done");
    scope(failure) writeln("Failure");

    writeln(read(__FILE__)); // works
    writeln(read(__FILE__)); // error

    return 0;
}

Debugging a little, I find that "fstat64(fd, &statbuf)" returns an gigantic
file size (more than 1 Go), which then gets passed to GC.malloc. So it seems
that fstat64 doesn't work correctly on Mac OS X, or more likely the layout of
struct_stat64 may be different on Mac OS X and this has not been taken into
account in the declaration.

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

Reply via email to