user1481860
user1481860

Reputation:

Large amounts of file handles to large files - potential problems?

Would keeping say 512 file handles to files sized 3GB+ open for the lifetime of a program, say a week or so, cause issues in 32-bit Linux? Windows?

Potential workaround: How bad is the performance penalty of opening/closing file handles?

Upvotes: 0

Views: 321

Answers (2)

LaC
LaC

Reputation: 12824

The size of the files doesn't matter. The number of file descriptors does, though. On Mac OS X, for example, the default limit is 256 open files per process, so your program would not be able to run.

Upvotes: 1

user541686
user541686

Reputation: 210593

I don't know about Linux, but in Windows, 512 files doesn't seem that much to me. But as a rule of thumb, any more than a thousand and it's too many. (Although I have to say that I haven't seen any program first-hand opening more than, say, 50.)

And the cost of opening/closing handles isn't that big unless you do them every time you want to read/write a small amount, in which case it's too high and you should buffer your data.

Upvotes: 0

Related Questions