Too Many Open Files (was Re: The CLOSE command)

Jeff Harrison jeffaharrison at yahoo.com
Mon Feb 20 05:55:44 PST 2006


--- Fairlight <fairlite at fairlite.com> wrote:

[snip] 
> I agree.  But you -should- close it at the first
> atomic moment you're done
> with the -batch- of lookups then, if you have
> further processing to do--not
> just let them hang open until you're done.
> 
> > So what?  You have a few more files open than your
> need.  I believe that
> > the alternative of too many opens and closes is
> far more costly.  Again,
> > filepro will close the files as needed.  If it
> does not, then it is a bug
> > in my opinion and should be fixed.
> 
> The fact that you ask, "So what?" only tells me you
> missed my point
> entirely.  I can only assume you are likely an
> application rather than
> systems person.  Okay, I'll break it down for you
> and the other non-systems
> folks, then.
> 
> Example:  You have a process that uses 10 external
> files.  Only 2 of these
> actually -need- to be open simultaneously.  Assume
> you don't close your
> files.  That's 10 file descriptors you've eaten
> through.  Add the base
> three fd's (STDIN/STDOUT/STDERR), and you're up to
> 13.  Per process.
> 
[snip]

I'll grant you that you should close a file after you
are sure you are done doing the batch of lookups.  It
is healthier from a systems perspective.  Except for
the few one-time lookups, however, this is usually at
the end of a filepro batch process.  Given that
filepro will close the file(s) here anyway, it is not
something that I typically worry about.

On the other hand, there are the non-batch processes. 
These are more difficult because you don't know what
the user will do next.  Again, I have no problem with
closing the one-time lookups - I agree it makes sense
to do this.  However, I do not tend to stress over
this especially in simple apps.

I do tend to look for files that I can close when I am
working on a very complicated app with many lookups to
many different files.  I consider this a situation
where there is a need to close the file(s).  But it is
important to choose the files that you close wisely.

Jeff Harrison
jeffaharrison at yahoo.com

Author of JHExport and JHImport.  The easiest and
fastest ways to generate code for filePro exports and
imports.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Filepro-list mailing list