|
|||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
#1 |
|
Prospect
Join Date: Jul 2007
Posts: 15
|
It is a very stange problem, about Creating and Opening Files
I made a test, i created and opened many files continuously, but not closed them. it always failed to create the new file at about the 250th file, not more than 256 files. i tried the functions, include fopen, HCreate, HopenDF, etc. All like this. I did the same work at Windows XP, it was successfully. This is very strange, do you think it is about Mac OS X system?
|
|
|
|
|
|
#2 |
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,956
|
Every operating system has a limit on the number of files that a process is allowed to have open. The exact number varies between operating systems and is usually configurable by the system administrator.
I.e. what you experienced doesn't seem strange at all - it is quite normal. It is usually a programming error to be opening so many files without closing them.
__________________
hayne.net/macosx.html |
|
|
|
|
|
#3 |
|
Hall of Famer
Join Date: Apr 2007
Posts: 4,262
|
just as an added point, I suspect most systems will use a binary limit (64, 128, 256, 512, 1024...) on the number of open files, just because - hey - it's a computer. the question you're having here is probably a credit to macs. for the most part, computers have no conception of an 'appropriate' limit to the number of open files that should be allowed. old systems would simply allow you to keep opening file after file after file until something overloads and the system crashes. apparently macs have put a limit on it. I'm guessing the limit can be changed programmatically, but be glad it's there...
|
|
|
|
|
|
#4 |
|
Prospect
Join Date: Jul 2007
Posts: 15
|
yeah,u r right. i ran "unlimit -n", it shows 256.How can i change this limit.
|
|
|
|
|
|
#5 | |||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,956
|
I'm not sure - but why do you need to change it? What are you trying to do? I.e. what is your higher-level goal?
__________________
hayne.net/macosx.html |
|||||||||||||||||||||||
|
|
|
|
|
#6 |
|
Prospect
Join Date: Jul 2007
Posts: 15
|
I created so many files as temporary files to store some image info. Not closing them is for the fast access in the future.So, it is why i need to do this.
|
|
|
|
|
|
#7 |
|
Triple-A Player
Join Date: Mar 2006
Posts: 110
|
I know it's not really an answer to your question, but ...
I'm not 100% sure why you would want to save large numbers of temporary image files but not close -- it may be faster to only keep open those files you need, as you use a lesser amount of system resources. And if you want really fast access, why write them to a file at all? Just keep them resident in memory. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|