Commit e1216bb
committed
Improve dudect test with memory leak fix
Valgrind inspection revealed memory leaks in the original code, with
43,632 bytes lost across 909 blocks per test. Analysis showed that the
initialization function was being called repeatedly within the testing
loop, each time reallocating the context array without any provision to
free prior memory allocations. This uncontrolled repetition caused
memory to accumulate not freed over multiple test iterations, leading to
the observed leaks. To correct this, the initialization process was
revised to execute only once before testing begins, and a cleanup was
added to release all allocated memory when testing concludes. To further
prevent memory-related issues, the measurement function was updated to
check all memory allocations, ensuring robustness against potential
failures.
Change-Id: Ia2639595a1015f792f1614e0771a6300ddaa22ff1 parent f53314e commit e1216bb
1 file changed
+15
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
180 | 191 | | |
181 | 192 | | |
182 | 193 | | |
| |||
187 | 198 | | |
188 | 199 | | |
189 | 200 | | |
190 | | - | |
| 201 | + | |
191 | 202 | | |
192 | 203 | | |
193 | 204 | | |
| |||
209 | 220 | | |
210 | 221 | | |
211 | 222 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | 223 | | |
222 | 224 | | |
223 | 225 | | |
224 | 226 | | |
| 227 | + | |
| 228 | + | |
225 | 229 | | |
226 | 230 | | |
227 | | - | |
228 | 231 | | |
229 | 232 | | |
230 | 233 | | |
| |||
235 | 238 | | |
236 | 239 | | |
237 | 240 | | |
| 241 | + | |
238 | 242 | | |
239 | 243 | | |
240 | 244 | | |
| |||
0 commit comments