Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Which is less costly in terms of memory, QFileSystemWatcher or inotify ??
Forum Updated to NodeBB v4.3 + New Features

Which is less costly in terms of memory, QFileSystemWatcher or inotify ??

Scheduled Pinned Locked Moved General and Desktop
13 Posts 4 Posters 5.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rex1254
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rex1254
        wrote on last edited by
        #3

        Thank you but I need to monitor directory recursively. Please correct me if i am wrong but if i use QFileSystemWatcher would it cost me more memory since QT need additional calls to use inotify

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          In terms of pure memory, indeed, it will cost a bit more.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • R Offline
            R Offline
            rex1254
            wrote on last edited by
            #5

            Thank your reply.

            1 Reply Last reply
            0
            • R Offline
              R Offline
              rex1254
              wrote on last edited by
              #6

              Will QFileSystemWatcher be replaced by some other file monitoring interface in the newer versions of QT ??
              If yes, then will the new interface still use inotify to monitor file and directory changes or will it use some other Linux functionality.

              1 Reply Last reply
              0
              • B Offline
                B Offline
                butterface
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  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.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    rex1254
                    wrote on last edited by
                    #9

                    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.

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      AlterX
                      wrote on last edited by
                      #10

                      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.

                      Qt Ambassador
                      Real-time cooperative teams: http://www.softairrealfight.net
                      Free Real-time network platform sdk: https://github.com/AlterX76/Solomon

                      https://codereview.qt-project.org/...

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        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

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • R Offline
                          R Offline
                          rex1254
                          wrote on last edited by
                          #12

                          Hi SGaist,
                          I do not remember the references but please check the below link. It is a suggestion for improving QFileSystemWatcher on Qt forum

                          http://qt-project.org/forums/viewthread/17228

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            It seems that it's still a work in progress

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            0

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved