Bug 7831 – Unlisted @@@BUG in File.detach causes FILE* leaks when reopening

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-05T11:55:00Z
Last change time
2012-06-11T12:24:17Z
Assigned to
nobody
Creator
dlang-bugzilla
Blocks
7022
See also
http://d.puremagic.com/issues/show_bug.cgi?id=7022

Comments

Comment #0 by dlang-bugzilla — 2012-04-05T11:55:36Z
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; }
Comment #1 by mike — 2012-06-11T12:24:17Z