Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
October 20, 2009 [Issue 3424] New: Ref counting still doesn't work for std.stdio.File | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=3424 Summary: Ref counting still doesn't work for std.stdio.File Product: D Version: 2.035 Platform: Other OS/Version: Windows Status: NEW Severity: critical Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: dsimcha@yahoo.com --- Comment #0 from David Simcha <dsimcha@yahoo.com> 2009-10-20 09:22:29 PDT --- If this can't be fixed in short order it should at least be documented so that people don't rely on the ref counting and auto closing. Here's a test case to show it doesn't work. This fails on both Windows and Linux. import std.stdio, std.file; void main() { std.file.write("foo.txt", "stuff"); foreach(i; 0..1_000_000) { openStuff(); // Throws too many files error rather quickly. } } void openStuff() { File myFile = File("foo.txt"); // Not automatically closed. } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 20, 2009 [Issue 3424] Ref counting still doesn't work for std.stdio.File | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | http://d.puremagic.com/issues/show_bug.cgi?id=3424 Andrei Alexandrescu <andrei@metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |andrei@metalanguage.com Resolution| |FIXED --- Comment #1 from Andrei Alexandrescu <andrei@metalanguage.com> 2009-10-20 13:03:22 PDT --- (In reply to comment #0) > If this can't be fixed in short order it should at least be documented so that people don't rely on the ref counting and auto closing. Here's a test case to show it doesn't work. This fails on both Windows and Linux. > > import std.stdio, std.file; > > void main() { > std.file.write("foo.txt", "stuff"); > foreach(i; 0..1_000_000) { > openStuff(); // Throws too many files error rather quickly. > } > } > > void openStuff() { > File myFile = File("foo.txt"); > // Not automatically closed. > } I'm glad to report I just fixed this and committed stdio.d. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 21, 2009 [Issue 3424] Ref counting still doesn't work for std.stdio.File | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | http://d.puremagic.com/issues/show_bug.cgi?id=3424 Leandro Lucarella <llucax@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |llucax@gmail.com --- Comment #2 from Leandro Lucarella <llucax@gmail.com> 2009-10-20 17:29:50 PDT --- Your commit, r1300, also removes some opSlice(): @@ -736,10 +740,4 @@ /// Range primitive implementations. - ByLine!(Char, Terminator) opSlice() - { - return this; - } - - /// Ditto bool empty() const { Is this intended? If so, it would be nice if you could apply the changes in two different commits (if they are really unrelated, as I think they are; if not, please ignore this comment :). I'm sorry to say this here I guess it's not the place, but I don't know of a better place. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 21, 2009 [Issue 3424] Ref counting still doesn't work for std.stdio.File | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | http://d.puremagic.com/issues/show_bug.cgi?id=3424 --- Comment #3 from Andrei Alexandrescu <andrei@metalanguage.com> 2009-10-20 17:38:19 PDT --- (In reply to comment #2) > Your commit, r1300, also removes some opSlice(): > > @@ -736,10 +740,4 @@ > > /// Range primitive implementations. > - ByLine!(Char, Terminator) opSlice() > - { > - return this; > - } > - > - /// Ditto > bool empty() const > { > > > Is this intended? If so, it would be nice if you could apply the changes in two different commits (if they are really unrelated, as I think they are; if not, please ignore this comment :). > > I'm sorry to say this here I guess it's not the place, but I don't know of a better place. For a brief period, Walter required opSlice for foreach to work. He subsequently changed that, so I clean up that stuff when I get the opportunity. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 21, 2009 [Issue 3424] Ref counting still doesn't work for std.stdio.File | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | http://d.puremagic.com/issues/show_bug.cgi?id=3424 --- Comment #4 from Leandro Lucarella <llucax@gmail.com> 2009-10-20 17:50:14 PDT --- (In reply to comment #3) > (In reply to comment #2) > > Your commit, r1300, also removes some opSlice(): > > > > @@ -736,10 +740,4 @@ > > > > /// Range primitive implementations. > > - ByLine!(Char, Terminator) opSlice() > > - { > > - return this; > > - } > > - > > - /// Ditto > > bool empty() const > > { > > > > > > Is this intended? If so, it would be nice if you could apply the changes in two different commits (if they are really unrelated, as I think they are; if not, please ignore this comment :). > > > > I'm sorry to say this here I guess it's not the place, but I don't know of a better place. > > For a brief period, Walter required opSlice for foreach to work. He subsequently changed that, so I clean up that stuff when I get the opportunity. Ok, that comment would be an excellent commit message for a separated commit removing the opSlice() ;) Thanks for the clarification. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 21, 2009 [Issue 3424] Ref counting still doesn't work for std.stdio.File | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | http://d.puremagic.com/issues/show_bug.cgi?id=3424 Brad Roberts <braddr@puremagic.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |braddr@puremagic.com --- Comment #5 from Brad Roberts <braddr@puremagic.com> 2009-10-20 18:26:12 PDT --- The two @@BUG@@ comments that are still there.. is there still a bug? If so, what is the bug number? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation