OSDN Git Service

Fix crashes when loading large .qmlproject's (Mac OS X)
authorKai Koehne <kai.koehne@nokia.com>
Fri, 28 May 2010 11:45:53 +0000 (13:45 +0200)
committerKai Koehne <kai.koehne@nokia.com>
Fri, 28 May 2010 12:14:42 +0000 (14:14 +0200)
commit7f1f9e14afe5170faba0c19c0732f54bd7982184
tree4d0e20c8855966102f0acf6ea29bd8de0a7764a7
parent3082395c14b251d7ecd95be40fc22f750ad500da
Fix crashes when loading large .qmlproject's (Mac OS X)

There is a hard limit on the number of file handles that can be open at one point per process on Mac OS X (e.g. it's 2560 on Mac OS X Snow Leopard Server, as shown by ulimit -a). Opening one or several .qmlproject's with a large number of directories to watch easily exceeds this. The results are crashes later on, e.g. when threads cannot be created any more.

This patch implements a heuristic that the file system watcher used for .qmlproject files never uses more than half the number of available file handles. It also increases the number from rlim_cur to rlim_max - the old code in main.cpp failed, see last section in

 http://developer.apple.com/maac/library/documentation/Darwin/Reference/ManPages/man2/setrlimit.2.html

for details.

Reviewed-by: ckamm
Task-number: QTCREATORBUG-1487
Task-number: QTCREATORBUG-1486
src/app/main.cpp
src/plugins/qmlprojectmanager/fileformat/filesystemwatcher.cpp