www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3424] New: Ref counting still doesn't work for std.stdio.File

reply d-bugmail puremagic.com writes:
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



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: -------
Oct 20 2009
next sibling parent d-bugmail puremagic.com writes:
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



13:03:22 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.
 }
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: -------
Oct 20 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3424


Leandro Lucarella <llucax gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |llucax gmail.com



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: -------
Oct 20 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3424




17:38:19 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.
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: -------
Oct 20 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3424




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.
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: -------
Oct 20 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3424


Brad Roberts <braddr puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |braddr puremagic.com



---
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: -------
Oct 20 2009