[Issue 7972] New: std.file.read allocate a buffer the size of the file even when given a upper limit

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 23 02:18:20 PDT 2012


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

           Summary: std.file.read allocate a buffer the size of the file
                    even when given a upper limit
           Product: D
           Version: future
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: tbanelwebmin at free.fr


--- Comment #0 from tbanelwebmin at free.fr 2012-04-23 02:19:18 PDT ---
import std.file;
read ("/path/to/bigfile", 1024);

a core.exception.OutOfMemoryError is thrown.

--------

This is because a buffer the size of "/path/to/bigfile" is allocated,
instead of 1024

--------

Fix

Go to file std/file.d line 327
change maxInitialAlloc to minInitialAlloc

When done, the maxInitialAlloc is no longer usefull and may be removed.

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