@@ -60,16 +60,16 @@ QString MassifAnalyzer::detectMemoryLeaks(const QVector<Snapshot>& snapshots, Ma
6060 }
6161
6262 if (heapJump >= MEMORY_JUMP_THRESHOLD) {
63- result += QString (" Info: Heap memory jump between snapshot %1 and snapshot %2 is %3%\n " )
63+ result += QString (" ℹ️ [ Info] Heap memory jump between snapshot %1 and snapshot %2 is %3%\n " )
6464 .arg (previousSnapshot.snapshot )
6565 .arg (snap.snapshot )
6666 .arg (heapJump * 100 , 0 , ' f' , 2 );
6767
6868 if (isMemoryStabilized (snapshots, i, WINDOWS_SIZE_TRESHOLD)) {
69- result += QString (" Note: Memory stabilized after snapshot %1\n " )
69+ result += QString (" 📝 [ Note] Memory stabilized after snapshot %1\n " )
7070 .arg (snap.snapshot );
7171 } else {
72- result += QString (" Warning: Memory continues to grow after snapshot %1\n " )
72+ result += QString (" ⚠️ [ Warning] Memory continues to grow after snapshot %1\n " )
7373 .arg (snap.snapshot );
7474 }
7575 }
@@ -86,21 +86,21 @@ QString MassifAnalyzer::detectMemoryLeaks(const QVector<Snapshot>& snapshots, Ma
8686 }
8787
8888 if (stackJump > MEMORY_JUMP_THRESHOLD) {
89- result += QString (" Info: Stack memory jump between snapshot %1 and snapshot %2 is %3%\n " )
89+ result += QString (" ℹ️ [ Info] Stack memory jump between snapshot %1 and snapshot %2 is %3%\n " )
9090 .arg (previousSnapshot.snapshot )
9191 .arg (snap.snapshot )
9292 .arg (stackJump * 100 , 0 , ' f' , 2 );
9393 }
9494 }
9595
9696 if (snap.mem_heap_B > LARGE_MEMORY_THRESHOLD) {
97- result += QString (" Warning: Large heap memory detected in snapshot %1: %2 MB\n " )
97+ result += QString (" ⚠️ [ Warning] Large heap memory detected in snapshot %1: %2 MB\n " )
9898 .arg (snap.snapshot )
9999 .arg (snap.mem_heap_B / BYTES_TO_MB);
100100 }
101101
102102 if (snap.mem_stacks_B > LARGE_MEMORY_THRESHOLD) {
103- result += QString (" Warning: Large stack memory detected in snapshot %1: %2 MB\n " )
103+ result += QString (" ⚠️ [ Warning] Large stack memory detected in snapshot %1: %2 MB\n " )
104104 .arg (snap.snapshot )
105105 .arg (snap.mem_stacks_B / BYTES_TO_MB);
106106 }
@@ -111,35 +111,24 @@ QString MassifAnalyzer::detectMemoryLeaks(const QVector<Snapshot>& snapshots, Ma
111111 hasPreviousSnapshot = true ;
112112 }
113113
114- if (snap.mem_heap_B > 0 ) { // da ne deliš sa nulom
114+ if (snap.mem_heap_B > 0 ) { // not to divide with 0
115115 double fragmentationRatio = static_cast <double >(snap.mem_heap_extra_B ) / snap.mem_heap_B ;
116116
117117 if (fragmentationRatio > FRAGMENTATION_THRESHOLD) {
118- result += QString (" Warning: Possible heap fragmentation in snapshot %1: extra memory is %2% of heap\n " )
118+ result += QString (" ⚠️ [ Warning] Possible heap fragmentation in snapshot %1: extra memory is %2% of heap\n " )
119119 .arg (snap.snapshot )
120120 .arg (fragmentationRatio * 100 , 0 , ' f' , 2 );
121121 }
122122 }
123123
124124 if (i == snapshots.size () - 1 ){
125125 if (snap.mem_heap_B > MEMORY_FREE_THRESHOLD) {
126- result += QString (" Warning: Memory not fully freed at the end! Heap usage: %1 bytes\n " )
126+ result += QString (" ⚠️ [ Warning] Memory not fully freed at the end! Heap usage: %1 bytes\n " )
127127 .arg (snap.mem_heap_B );
128128 } else {
129- result += QString (" Info: Memory fully freed at the end.\n " );
129+ result += QString (" ℹ️ [ Info] Memory fully freed at the end.\n " );
130130 }
131131 }
132-
133- // if (!snap.allocations.isEmpty()) {
134- // result += QString("Top allocations in snapshot %1\n").arg(snap.snapshot);
135- // for (const AllocationEntry& alloc : snap.allocations) {
136- // result += QString("%1 bytes in %2 at %3 : %4\n")
137- // .arg(alloc.bytes)
138- // .arg(alloc.function)
139- // .arg(alloc.sourceFile)
140- // .arg(alloc.line);
141- // }
142- // }
143132 }
144133
145134 return result;
@@ -155,24 +144,24 @@ QString MassifAnalyzer::generateFunctionAllocationReport(const QMap<QString, Fun
155144 for (auto it = functionSummary.constBegin (); it != functionSummary.constEnd (); ++it) {
156145 const FunctionAllocSummary& summary = it.value ();
157146
158- result += QString (" Function '%1' allocated total %2 bytes in %3 allocations.\n " )
147+ result += QString (" 📌 [Function] \n ℹ️ [Info] Function '%1' allocated total %2 bytes in %3 allocations.\n " )
159148 .arg (summary.function )
160149 .arg (summary.totalBytes )
161150 .arg (summary.count );
162151
163152 // Warn if a function allocates a lot of memory
164153 if (summary.totalBytes > HIGH_MEMORY_THRESHOLD) {
165- result += QString (" Warning: Function '%1' is responsible for a large memory allocation (over 100MB).\n " )
154+ result += QString (" ⚠️ [ Warning] Function '%1' is responsible for a large memory allocation (over 100MB).\n " )
166155 .arg (summary.function );
167156 }
168157
169158 if (summary.count > HIGH_ALLOCATION_COUNT) {
170159 if (summary.totalBytes < SMALL_TOTAL_ALLOCATION) {
171- result += QString (" Note: Function '%1' performs many small allocations (%2); consider optimizing with preallocation or pooling.\n " )
160+ result += QString (" 📝 [ Note] Function '%1' performs many small allocations (%2); consider optimizing with preallocation or pooling.\n " )
172161 .arg (summary.function )
173162 .arg (summary.count );
174163 } else {
175- result += QString (" Note: Function '%1' performs many allocations (%2); consider checking for inefficiencies.\n " )
164+ result += QString (" 📝 [ Note] Function '%1' performs many allocations (%2); consider checking for inefficiencies.\n " )
176165 .arg (summary.function )
177166 .arg (summary.count );
178167 }
@@ -181,5 +170,11 @@ QString MassifAnalyzer::generateFunctionAllocationReport(const QMap<QString, Fun
181170 result += " \n " ;
182171 }
183172
173+ result += " 📝 [Note] Lines are ignored if:\n "
174+ " - They refer to unnamed or unknown functions.\n "
175+ " - Their memory allocation is below a configured threshold (default: 1.00% of total memory).\n "
176+ " - They are structurally malformed or unsupported by the current parser.\n "
177+ " - They match known standard library or internal functions (e.g., `std::`, `__gnu_cxx::`, `boost::`, `operator new`, etc.)." ;
178+
184179 return result;
185180}
0 commit comments