www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4490] New: File ref counting broken for anonymous File structs

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4490

           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
        AssignedTo: nobody puremagic.com
        ReportedBy: dsimcha yahoo.com


--- Comment #0 from David Simcha <dsimcha yahoo.com> 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) {
        File("foo.txt");
    }
}

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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 20 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4490


David Simcha <dsimcha yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |3516


--- Comment #1 from David Simcha <dsimcha yahoo.com> 2010-07-25 10:12:38 PDT ---
Apparently, this is caused by bug 3516, rather than being a bug in Phobos per
se.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 25 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4490


David Simcha <dsimcha yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #2 from David Simcha <dsimcha yahoo.com> 2011-08-12 20:38:43 PDT ---
Resolved by fixing temporary destruction.

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