From 7ca481281d63aa790b6e36e8d97656a886e87c79 Mon Sep 17 00:00:00 2001 From: Johannes Huber Date: Tue, 7 Aug 2012 17:45:24 +0000 Subject: Revision bump adds upstream patch which fixes memleak in knotify spotted by Dennis Schridde wrt bug #430226. Remove old. (Portage version: 2.2.0_alpha120/cvs/Linux i686) --- kde-base/nepomuk-core/ChangeLog | 10 +- .../nepomuk-core-4.9.0-kinotify-memleak.patch | 105 +++++++++++++++++++++ kde-base/nepomuk-core/nepomuk-core-4.9.0-r1.ebuild | 25 +++++ kde-base/nepomuk-core/nepomuk-core-4.9.0.ebuild | 23 ----- 4 files changed, 139 insertions(+), 24 deletions(-) create mode 100644 kde-base/nepomuk-core/files/nepomuk-core-4.9.0-kinotify-memleak.patch create mode 100644 kde-base/nepomuk-core/nepomuk-core-4.9.0-r1.ebuild delete mode 100644 kde-base/nepomuk-core/nepomuk-core-4.9.0.ebuild (limited to 'kde-base') 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 + +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 wrt bug #430226. Remove old. 05 Aug 2012; Chris Reffett 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 +Date: Mon Aug 6 15:01:14 2012 +0530 + + kinotify: Do not store the paths to be added + + kinotify used a QQueue 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 . + 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 watchPathHash; + QHash pathWatchHash; + +- /// queue of paths to install watches for +- QQueue pathsToWatch; ++ /// A list of all the current dirIterators ++ QQueue 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-r1.ebuild b/kde-base/nepomuk-core/nepomuk-core-4.9.0-r1.ebuild new file mode 100644 index 000000000000..45a2cebbf348 --- /dev/null +++ b/kde-base/nepomuk-core/nepomuk-core-4.9.0-r1.ebuild @@ -0,0 +1,25 @@ +# 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-r1.ebuild,v 1.1 2012/08/07 17:45:24 johu Exp $ + +EAPI=4 + +KDE_SCM="git" +inherit kde4-base + +DESCRIPTION="Nepomuk core libraries" +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" +IUSE="debug" + +DEPEND=" + >=app-misc/strigi-0.7.7[dbus,qt4] + >=dev-libs/soprano-2.8.0[dbus,raptor,redland,virtuoso] +" +RDEPEND="${DEPEND}" + +add_blocker nepomuk '<4.8.80' + +RESTRICT="test" +# bug 392989 + +PATCHES=( "${FILESDIR}/${P}-kinotify-memleak.patch" ) diff --git a/kde-base/nepomuk-core/nepomuk-core-4.9.0.ebuild b/kde-base/nepomuk-core/nepomuk-core-4.9.0.ebuild deleted file mode 100644 index 97d982322100..000000000000 --- a/kde-base/nepomuk-core/nepomuk-core-4.9.0.ebuild +++ /dev/null @@ -1,23 +0,0 @@ -# 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 $ - -EAPI=4 - -KDE_SCM="git" -inherit kde4-base - -DESCRIPTION="Nepomuk core libraries" -KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" -IUSE="debug" - -DEPEND=" - >=app-misc/strigi-0.7.7[dbus,qt4] - >=dev-libs/soprano-2.8.0[dbus,raptor,redland,virtuoso] -" -RDEPEND="${DEPEND}" - -add_blocker nepomuk '<4.8.80' - -RESTRICT="test" -# bug 392989 -- cgit v1.2.3-65-gdbad