Summary: File ref counting broken for anonymous File structs
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos

--- Comment #0 from David Simcha <> 2010-07-20 13:24:51 PDT ---
The following runs out of file handles on both Windows and Linux:

import std.stdio;

void main() {
    // Assumes you have a file called "foo.txt" laying around.  If you don't,
    // create one.
    while(1) {

The following while loop body also does:

auto lines = File("foo.txt").byLine();

The following does not:

auto handle = File("foo.txt");

Marking as major because it silently breaks code in subtle ways.  I wrote
several small programs that relied on reference counting to free the file
handle, which seemed to work fine until one day I made them use a lot more file
handles than they usually do.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to