www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7831] New: Unlisted BUG in File.detach causes FILE* leaks when reopening

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

           Summary: Unlisted    BUG in File.detach causes FILE* leaks when
                    reopening
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: thecybershadow gmail.com



11:55:36 PDT ---
This is a variant of bug 3424.

import std.file, std.stdio;

void main() {
    std.file.write("foo.txt", "stuff");
    File f;
    foreach(i; 0..1_000_000) {
        f.open("foo.txt");  // Throws too many files error rather quickly.
    }
}


The relevant part of std.stdio (line 378):

/**
Detaches from the underlying file. If the sole owner, calls $(D close)
and throws if that fails.
  */
    void detach()
    {
        if (!p) return;
        //    BUG
        //if (p.refs == 1) close();
        p = null;
    }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 05 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7831


Mike Wey <mike-wey planet.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |mike-wey planet.nl
         Resolution|                            |FIXED



Fixed by github commit:
https://github.com/D-Programming-Language/phobos/commit/f1566faeafec6715f227cb7d3bbe3af3737de4b3

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