Re: too many open files

Georg Tuparev <[email protected]>
Newsgroups gmane.comp.web.webobjects.admin
Message-ID <[email protected]>
Pierre,

On Feb 11, 2004, at 2:43 PM, Pierre Frisch wrote:

> Can you be a bit more explicit?

Sure

> Each process on MacOS has a limit of 256 open files you must have open 
> an awful number file to reach that limit?

Well, in my case (I had this headache few months ago) I was opening a 
huge file containing bank transactions, and  I was splitting them by 
account (one file for each account). All transactions are sorted  - so 
at any time I had max two files opened (the source file, and the 
current account file). This was done in a loop over all accounts. For 
each output file we do something like this:

FileWriter w = new FileWriter(new File(fileName));
// Write some data
w.flush();
w.close();
w = null;

One would think this is enough... wrong! We had to kick the GC in order 
to really free the file handles. Fun, isn't it?

> Or is there another mechanism? Are the file handle in static methods?

In the case of the new application that start making trouble two weeks 
ago, there were some reads (both in static and instance methods) done 
using WOResourceManager (some custom SQL, image data etc), and some 
files similar to what I described above. In both cases they all were 
closed properly, but we had to kick the GC again.

<dreaming>
WO 6.0 will be in Objective-C
</dreaming>

-- georg --

"War is God's way of teaching Americans about geography."
Ambrose Bierce, writer (1842-1914)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.