Which is less costly in terms of memory, QFileSystemWatcher or inotify ??
-
Hi,
I want to make an C++ application that will monitor file changes in its directory or its sub-directories in linux. I know inotify in linux and QFileSystemWatcher can monitor single level directory changes and need to manually add a watch for each sub-directory to detect changes in the sub-directory.I need to know which is more memory efficient, using inotify with QT or QFileSystemWatcher to monitor directory changes on linux
-
Hi and welcome to devnet,
AFAIK QFileSystemWatcher uses inotify for it's linux implementations so the functionality in itself is the same. The best thing to do is to make some tests to see which one fits the best for your use case.
-
In terms of pure memory, indeed, it will cost a bit more.
-
-
Why is that relevant? If it is really that critical you might think of using something else (your own implementation for example) or if still not sufficient a completely different system at all.
-
Why would it need to be replaced ? It does the job well. If you would like to support another system than you can create your own backend for QFileSystemWatcher.
-
Sorry, I should have been more specific about my question. I am not suggesting to replace QFileSystemWatcher. I asked this question because when I was searching for a solution on Google I came across articles and forum comments with suggestions to replace/modify/update QQFileSystemWatcher in new version of QT. I thought QT may update QQFileSystemWatcher based on these suggestions or use some other subsystem like fanotify to make a new interface to monitor a directories for QT.
-
I think QFileSystemWatcher is using inotify under the hood in linux.
Of course using Qt you have an extra overhead to due architecture and so on, but if you plan to use on a desktop or server machine then it does not make sense to use inotify for performance reason. -
Depends on who wrote these articles and whether there's something pending. Can you give the references ?
On a side note, it's Qt, QT stands from Apple QuickTime
-
Hi SGaist,
I do not remember the references but please check the below link. It is a suggestion for improving QFileSystemWatcher on Qt forum -
It seems that it's still a work in progress