问题
I'm currently working on a cool Android game which was about to be released real soon. Some of our beta testers started complaining that the game crashes with the “too many open files” error message. I've tried simulating this problem on the AVD emulator but couldn't reproduce the error.
Afterwards, I realized that only our Galaxy S3 and Asus Nexus 7 testers were complaining. I found this bug issue on Android's bug tracker and it sounds quite similar to what is happening to me.
This sounds like a serious architecture problem which effects all internal SD card devices. These devices are limited to only 1024 file descriptors! Can anybody confirm this problem?
回答1:
Actually it is not relevant whether this app is opening a lot of files or not. What's troubling is that the entire device is limited to 1024 open files. Take for instance a Galaxy S3 device running 100 apps each opening 10 files concurrently(properties, databases and the like). This is extremely close to the limit.
If you check the max open files limit (/proc/sys/fs/file-max) on most devices it is well over 50K.
来源:https://stackoverflow.com/questions/13262339/can-anyone-confirm-this-issue-limited-number-of-file-descriptors-on-some-androi