diff options
author | Johannes Huber <johu@gentoo.org> | 2012-08-07 17:45:24 +0000 |
---|---|---|
committer | Johannes Huber <johu@gentoo.org> | 2012-08-07 17:45:24 +0000 |
commit | 7ca481281d63aa790b6e36e8d97656a886e87c79 (patch) | |
tree | e16d4880b1d39d75d8a59a306d81350544388301 /kde-base | |
parent | Stable for AMD64, wrt bug #420711 (diff) | |
download | gentoo-2-7ca481281d63aa790b6e36e8d97656a886e87c79.tar.gz gentoo-2-7ca481281d63aa790b6e36e8d97656a886e87c79.tar.bz2 gentoo-2-7ca481281d63aa790b6e36e8d97656a886e87c79.zip |
Revision bump adds upstream patch which fixes memleak in knotify spotted by Dennis Schridde <devurandom@gmx.net> wrt bug #430226. Remove old.
(Portage version: 2.2.0_alpha120/cvs/Linux i686)
Diffstat (limited to 'kde-base')
-rw-r--r-- | kde-base/nepomuk-core/ChangeLog | 10 | ||||
-rw-r--r-- | kde-base/nepomuk-core/files/nepomuk-core-4.9.0-kinotify-memleak.patch | 105 | ||||
-rw-r--r-- | kde-base/nepomuk-core/nepomuk-core-4.9.0-r1.ebuild (renamed from kde-base/nepomuk-core/nepomuk-core-4.9.0.ebuild) | 4 |
3 files changed, 117 insertions, 2 deletions
diff --git a/kde-base/nepomuk-core/ChangeLog b/kde-base/nepomuk-core/ChangeLog index 89805966e218..b8c360e4e165 100644 --- a/kde-base/nepomuk-core/ChangeLog +++ b/kde-base/nepomuk-core/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for kde-base/nepomuk-core # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/kde-base/nepomuk-core/ChangeLog,v 1.2 2012/08/05 05:03:41 creffett Exp $ +# $Header: /var/cvsroot/gentoo-x86/kde-base/nepomuk-core/ChangeLog,v 1.3 2012/08/07 17:45:24 johu Exp $ + +*nepomuk-core-4.9.0-r1 (07 Aug 2012) + + 07 Aug 2012; Johannes Huber <johu@gentoo.org> + +files/nepomuk-core-4.9.0-kinotify-memleak.patch, + +nepomuk-core-4.9.0-r1.ebuild, -nepomuk-core-4.9.0.ebuild: + Revision bump adds upstream patch which fixes memleak in knotify spotted by + Dennis Schridde <devurandom@gmx.net> wrt bug #430226. Remove old. 05 Aug 2012; Chris Reffett <creffett@gentoo.org> nepomuk-core-4.9.0.ebuild: Remove blocker on virtuoso-6.1.5, which was removed from the tree. diff --git a/kde-base/nepomuk-core/files/nepomuk-core-4.9.0-kinotify-memleak.patch b/kde-base/nepomuk-core/files/nepomuk-core-4.9.0-kinotify-memleak.patch new file mode 100644 index 000000000000..806f6c924ef5 --- /dev/null +++ b/kde-base/nepomuk-core/files/nepomuk-core-4.9.0-kinotify-memleak.patch @@ -0,0 +1,105 @@ +commit a81f05034baef438eacd346fcbc97dd818a0b5bf +Author: Vishesh Handa <me@vhanda.in> +Date: Mon Aug 6 15:01:14 2012 +0530 + + 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 + +diff --git a/services/filewatch/kinotify.cpp b/services/filewatch/kinotify.cpp +index e8843c8..47eb8ed 100644 +--- a/services/filewatch/kinotify.cpp ++++ b/services/filewatch/kinotify.cpp +@@ -79,8 +79,8 @@ public: + QHash<int, QByteArray> watchPathHash; + QHash<QByteArray, int> pathWatchHash; + +- /// queue of paths to install watches for +- QQueue<QByteArray> pathsToWatch; ++ /// A list of all the current dirIterators ++ QQueue<QDirIterator*> dirIterators; + + unsigned char eventBuffer[EVENT_BUFFER_SIZE]; + +@@ -136,20 +136,6 @@ public: + } + } + +- bool addWatchesRecursively( const QByteArray& path ) +- { +- if ( !addWatch( path ) ) +- return false; +- +- const QString stringPath = QFile::decodeName(path); +- QDirIterator iter( stringPath, QDir::Dirs | QDir::NoDotAndDotDot ); +- while( iter.hasNext() ) { +- pathsToWatch.enqueue( QFile::encodeName(iter.next()) ); +- } +- +- return true; +- } +- + void removeWatch( int wd ) { + kDebug() << wd << watchPathHash[wd]; + pathWatchHash.remove( watchPathHash.take( wd ) ); +@@ -159,19 +145,20 @@ public: + void _k_addWatches() { + // add the next batch of paths + for ( int i = 0; i < 100; ++i ) { +- if ( pathsToWatch.isEmpty() || +- !addWatchesRecursively( pathsToWatch.dequeue() ) ) { +- return; ++ QDirIterator* it = dirIterators.front(); ++ if( it->hasNext() ) { ++ it->next(); ++ addWatch( QFile::encodeName(it->filePath()) ); ++ } ++ else { ++ delete dirIterators.dequeue(); + } + } + + // asyncroneously add the next batch +- if ( !pathsToWatch.isEmpty() ) { ++ if ( !dirIterators.isEmpty() ) { + QMetaObject::invokeMethod( q, "_k_addWatches", Qt::QueuedConnection ); + } +- else { +- kDebug() << "All watches installed"; +- } + } + + private: +@@ -245,7 +232,10 @@ bool KInotify::addWatch( const QString& path, WatchEvents mode, WatchFlags flags + + d->mode = mode; + d->flags = flags; +- d->pathsToWatch.append( QFile::encodeName( path ) ); ++ d->addWatch( QFile::encodeName(path) ); ++ QDirIterator* iter = new QDirIterator( path, QDir::Dirs | QDir::NoDotAndDotDot, ++ QDirIterator::Subdirectories ); ++ d->dirIterators.append( iter ); + d->_k_addWatches(); + return true; + } diff --git a/kde-base/nepomuk-core/nepomuk-core-4.9.0.ebuild b/kde-base/nepomuk-core/nepomuk-core-4.9.0-r1.ebuild index 97d982322100..45a2cebbf348 100644 --- a/kde-base/nepomuk-core/nepomuk-core-4.9.0.ebuild +++ b/kde-base/nepomuk-core/nepomuk-core-4.9.0-r1.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/kde-base/nepomuk-core/nepomuk-core-4.9.0.ebuild,v 1.2 2012/08/05 05:03:41 creffett Exp $ +# $Header: /var/cvsroot/gentoo-x86/kde-base/nepomuk-core/nepomuk-core-4.9.0-r1.ebuild,v 1.1 2012/08/07 17:45:24 johu Exp $ EAPI=4 @@ -21,3 +21,5 @@ add_blocker nepomuk '<4.8.80' RESTRICT="test" # bug 392989 + +PATCHES=( "${FILESDIR}/${P}-kinotify-memleak.patch" ) |