Skip to content
Commit a81f0503 authored by Vishesh Handa's avatar Vishesh Handa
Browse files

kinotify: Do not store the paths to be added

kinotify used a QQueue<QByteArray> to store all the directories which
need to be added. Since we use QDirIterator, each path is presented as a
QString which is then encoded to its QByteArray (QFile::encodeName).
This results in *large* chunks of memory being allocated, and then
slowly being deallocated.

Instead, we now use a QDirIterator, and do not store all the directories
which need to be added, we simply iterate over them. This way we do not
allocate large amounts of memory.

There is a large performance improvement as well. On my system, with
38829 directories, adding all the watches now takes only about 10 seconds,
instead of about 65.

Patch possible due to massif output provided by Jure Repinc <jlp@holodeck1.com>.
Thanks a lot.

tldr: Use DFS instead of BFS -> Less memory consumption

BUG: 304476
REVIEW: 105892
DIGEST: Fix massive memory leak in Nepomuk File Monitoring Service
parent ea2e960a
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment