Skip zero-sized allocation entries in GUI.
authorRuben Ayrapetyan <r.ayrapetyan@samsung.com>
Fri, 15 Sep 2017 15:18:11 +0000 (18:18 +0300)
committerRuben Ayrapetyan <r.ayrapetyan@samsung.com>
Thu, 14 Sep 2017 15:08:48 +0000 (18:08 +0300)
src/analyze/allocationdata.h
src/analyze/gui/parser.cpp

index da99df3..e3bfc21 100644 (file)
@@ -52,6 +52,15 @@ struct AllocationData
         int64_t leaked = 0;
         // largest amount of bytes allocated
         int64_t peak = 0;
+
+        bool isEmpty() const
+        {
+            return (allocations == 0
+                    && temporary == 0
+                    && allocated == 0
+                    && leaked == 0
+                    && peak == 0);
+        }
     };
 
     Stats malloc, privateClean, privateDirty, shared;
index e29962c..c640493 100644 (file)
@@ -330,6 +330,12 @@ TreeData mergeAllocations(const ParserData& data, bool bIncludeLeaves)
     };
     // merge allocations, leave parent pointers invalid (their location may change)
     for (const auto& allocation : data.allocations) {
+        const AllocationData::Stats *stats = allocation.getDisplay();
+
+        if (stats->isEmpty()) {
+            continue;
+        }
+
         auto traceIndex = allocation.traceIndex;
 
         if (!bIncludeLeaves) {
@@ -340,11 +346,11 @@ TreeData mergeAllocations(const ParserData& data, bool bIncludeLeaves)
         while (traceIndex) {
             const auto& trace = data.findTrace(traceIndex);
             const auto& ip = data.findIp(trace.ipIndex);
-            auto location = data.stringCache.location(trace.ipIndex, ip);
-            rows = addRow(rows, location, *allocation.getDisplay());
+            auto location = data.stringCache.location(trace.ipIndex, ip, isUntrackedLocation);
+            rows = addRow(rows, location, *stats);
             for (const auto& inlined : ip.inlined) {
-                auto inlinedLocation = data.stringCache.frameLocation(inlined, ip.moduleIndex);
-                rows = addRow(rows, inlinedLocation, *allocation.getDisplay());
+                auto inlinedLocation = data.stringCache.frameLocation(inlined, ip.moduleIndex, isUntrackedLocation);
+                rows = addRow(rows, inlinedLocation, *stats);
             }
             if (data.isStopIndex(ip.frame.functionIndex)) {
                 break;