Re: GFileMonitor limit or g_signal_connect() connexions handling ?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 21/02/14 22:48, Olivier Delhomme wrote:
I'm using Glib 2.26 and I'm playing a bit with GFileMonitor. I'm trying to
monitor several
directories. It seems that the system works fine for a few directories (123
for instance)
but this does not work with more directories (19350 for instance).

Basically I'm using g_file_monitor call. The call does not raise any error.
Then I connect
a callback function to the "changed" signal of each monitor. I seems that
this function is
not called when there too much directories monitored. Yo can see my code
here :
https://github.com/dupgit/sauvegarde/blob/master/monitor/monitor.c

I'm trying to understand what is happening.

Is there a limit to the numbers of monitored directories ?
How are handled those signal connections to the callback function ?

Assuming you're running under Linux, you'll be using the inotify based
backend in the GFileMonitor. If that is the case, you're likely hitting
the max number of watches per inotify instance, specified in:
  /proc/sys/fs/inotify/max_user_watches

You can modify that value in runtime, e.g.:
  echo 16384 > /proc/sys/fs/inotify/max_user_watches

Or to make it permanent, add the following to /etc/sysctl.conf
  fs.inotify.max_user_watches=16384

Cheers,

- -- 
Aleksander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlMLTPsACgkQgxIgkKLogl4UvQCgyyY+H6+WDXbKciCB0QM0PnfM
3nYAniVU+sQtQ3CdTN0HCeLymOXMcTe5
=x4/y
-----END PGP SIGNATURE-----


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]