[Pkg-owncloud-commits] [owncloud-client] 42/121: Reduce the memory usage of the StopWatch during propagation

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Jul 28 15:31:55 UTC 2016


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit edfd75949dbb978486f4826d9ee8179e7655fa1b
Author: Jocelyn Turcotte <jturcotte at woboq.com>
Date:   Fri Jun 17 19:09:37 2016 +0200

    Reduce the memory usage of the StopWatch during propagation
    
    Use a QMap to avoid using a full hashtable for only a few entries, and
    clear the QMap once we're done with the measuring. This saves a few
    hundred bytes per job during propagation that would otherwise only be
    freed at the end of the sync.
---
 src/libsync/propagateupload.cpp | 2 ++
 src/libsync/utility.h           | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp
index 795a2f2..f601062 100644
--- a/src/libsync/propagateupload.cpp
+++ b/src/libsync/propagateupload.cpp
@@ -779,6 +779,8 @@ void PropagateUploadFileQNAM::slotPutFinished()
              << _stopWatch.durationOfLap(QLatin1String("ContentChecksum"))
              << _stopWatch.durationOfLap(QLatin1String("TransmissionChecksum"))
              << _item->_requestDuration;
+    // The job might stay alive for the whole sync, release this tiny bit of memory.
+    _stopWatch.reset();
 
     finalize(*_item);
 }
diff --git a/src/libsync/utility.h b/src/libsync/utility.h
index 044988f..6dd2f17 100644
--- a/src/libsync/utility.h
+++ b/src/libsync/utility.h
@@ -20,7 +20,7 @@
 #include <QByteArray>
 #include <QDateTime>
 #include <QElapsedTimer>
-#include <QHash>
+#include <QMap>
 
 namespace OCC {
 
@@ -121,7 +121,7 @@ namespace Utility
 
     class OWNCLOUDSYNC_EXPORT StopWatch {
     private:
-        QHash<QString, quint64> _lapTimes;
+        QMap<QString, quint64> _lapTimes;
         QDateTime _startTime;
         QElapsedTimer _timer;
     public:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list