'Too many files open' error. is there any limitation by JVM?
1 posts in topic
Flat View  Flat View

Posted By:   Madheswaran_Rathinam
Posted On:   Thursday, July 5, 2001 03:13 AM


When I m opening a large number of files (say morethan 1000) and i m getting the following exception.

"java.io.FileNotFoundException: d: empSortComponentFile2677.sort (Too many open files)"

I want to know, whether JVM puts any limitation on the number of files that
can be opened? if so, can we increase the number?

[Note: I m able to open more than 25000 (yes, 25K) files using a C program.]

Thanks for any help...


Re: 'Too many files open' error. is there any limitation by JVM?

Posted By:   Tim_Rohaly  
Posted On:   Sunday, July 8, 2001 07:41 PM

No, there is no limit imposed by the JVM. There are
however limits imposed by your OS. This is typically
configurable in your OS in a manner dependent on your OS.
The reason you may be seeing a different limit with a Java
program than with a C program may have to do with
garbage collection. In particular, a file descriptor isn't released until
the file stream object is garbage collected, unless you
explicitly invoke close() on that object (and I suspect
from your problem you aren't doing this).
Read http://www.jguru.com/faq/view.jsp?EID=262691 for a detailed
description of how garbage collection affects available resources.
About | Sitemap | Contact