summaryrefslogtreecommitdiffstats
path: root/src/corelib/arch
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-08-04 11:17:47 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-08-04 11:17:47 (GMT)
commitbe212bf108e71ba3b5b75802b1f4de6613ba315c (patch)
treec541ad12e8698f04e8fe386c2e1b94e8baca6c1b /src/corelib/arch
parent67ae1b0dac175f48875507f3187ed49276a29ddf (diff)
parente6bb00250b321b149dd80259dc4f479088d5949b (diff)
downloadQt-be212bf108e71ba3b5b75802b1f4de6613ba315c.zip
Qt-be212bf108e71ba3b5b75802b1f4de6613ba315c.tar.gz
Qt-be212bf108e71ba3b5b75802b1f4de6613ba315c.tar.bz2
Merge commit 'origin/master'
Conflicts: src/corelib/global/qglobal.h src/corelib/kernel/qmetatype.cpp src/corelib/kernel/qobject.cpp src/corelib/thread/qthread_unix.cpp src/gui/graphicsview/qgraphicssceneevent.h src/gui/itemviews/qheaderview.h src/gui/kernel/qapplication_qws.cpp src/gui/kernel/qgesture.h src/gui/kernel/qgesturerecognizer.h src/gui/painting/qpaintengine_raster.cpp src/network/access/qhttpnetworkreply.cpp src/network/access/qnetworkcookie.h src/network/socket/qnativesocketengine_unix.cpp
Diffstat (limited to 'src/corelib/arch')
-rw-r--r--src/corelib/arch/symbian/qatomic_symbian.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/corelib/arch/symbian/qatomic_symbian.cpp b/src/corelib/arch/symbian/qatomic_symbian.cpp
index 170b737..a228696 100644
--- a/src/corelib/arch/symbian/qatomic_symbian.cpp
+++ b/src/corelib/arch/symbian/qatomic_symbian.cpp
@@ -42,6 +42,37 @@
#include <QtCore/qglobal.h>
#include <QtCore/qatomic.h>
+#include <e32debug.h>
+
+// Heap and handle info printer. This code is placed here as it happens to make it the very last static to be destroyed in a Qt app.
+// This way we can report on heap cells and handles that are really not owned by anything which still exists.
+// This information can be used to detect whether memory leaks are happening, particularly if these numbers grow as the app is used more.
+struct SPrintExitInfo
+{
+ SPrintExitInfo()
+ {
+ RThread().HandleCount(initProcessHandleCount,initThreadHandleCount);
+ initCells = User::CountAllocCells();
+ }
+ ~SPrintExitInfo()
+ {
+ RProcess myProc;
+ TFullName fullName = myProc.FileName();
+ TInt cells = User::CountAllocCells();
+ TInt processHandleCount=0;
+ TInt threadHandleCount=0;
+ RThread().HandleCount(processHandleCount,threadHandleCount);
+ RDebug::Print(_L("%S exiting with %d allocated cells, %d handles"),
+ &fullName,
+ cells - initCells,
+ (processHandleCount + threadHandleCount) - (initProcessHandleCount + initThreadHandleCount));
+ }
+ TInt initCells;
+ TInt initProcessHandleCount;
+ TInt initThreadHandleCount;
+} printExitInfo;
+
+
#if defined(Q_CC_RVCT)
#include "../arm/qatomic_arm.cpp"
@@ -76,4 +107,3 @@ __declspec(dllexport) __asm int QBasicAtomicInt::fetchAndStoreOrdered(int newVal
QT_END_NAMESPACE
#endif // Q_CC_RVCT
-