<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div dir="ltr" class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class="">After figuring out how to get ModemManager and libglib2 to compile with debug symbols (Never do it in combination with Buildroot), we found that, when we enabled GPS using:<div class=""><br class=""></div><div class=""><i class="">> mmcli -m 0 —location-enable-gps-nmea</i></div><div class=""><i class="">> mmcli -m 0 —location-enable-gps-raw</i></div><div class=""><i class="">> mmcli -m 0 —location-set-enable-signal</i></div><div class=""><i class="">> mmcli -m 0 —location-set-gps-refresh-rate=0</i></div><div class=""><br class=""></div><div class="">a significant memory leak starts to appear, about 128 kB in 10 min runtime. This starts somewhere during the part where ModemManager is receiving the NMEA lines via the QMI and after that tries to parse them. See below for a snippet of the valgrind log:</div><div class=""><div class=""><br class=""></div><div class=""><div class="">==5713== 279 bytes in 7 blocks are possibly lost in loss record 1,174 of 1,184</div><div class="">==5713== at 0x4847EB4: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)</div><div class="">==5713== </div><div class="">==5713== 480 bytes in 4 blocks are possibly lost in loss record 1,175 of 1,184</div><div class="">==5713== at 0x484AB84: realloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)</div><div class="">==5713== </div><div class="">==5713== 1,032 bytes in 18 blocks are possibly lost in loss record 1,176 of 1,184</div><div class="">==5713== at 0x484A904: calloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)</div><div class="">==5713== </div><div class="">==5713== 1,267 bytes in 6 blocks are indirectly lost in loss record 1,177 of 1,184</div><div class="">==5713== at 0x484AB84: realloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)</div><div class="">==5713== </div><div class="">==5713== 2,393 bytes in 102 blocks are indirectly lost in loss record 1,178 of 1,184</div><div class="">==5713== at 0x4847EB4: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)</div><div class="">==5713== </div><div class="">==5713== 4,046 (24 direct, 4,022 indirect) bytes in 1 blocks are definitely lost in loss record 1,179 of 1,184</div><div class="">==5713== at 0x4E36C24: g_type_create_instance (gtype.c:1844)</div><div class="">==5713== by 0x4E139B3: g_object_new_internal (gobject.c:1799)</div><div class="">==5713== by 0x4E158C3: g_object_new_valist (gobject.c:2122)</div><div class="">==5713== by 0x4E15C7F: g_object_new (gobject.c:1642)</div><div class="">==5713== by 0xE1F9B: mm_port_qmi_new (mm-port-qmi.c:615)</div><div class="">==5713== by 0x620AB: mm_base_modem_grab_port (mm-base-modem.c:295)</div><div class="">==5713== by 0xA665F: mm_plugin_create_modem (mm-plugin.c:1048)</div><div class="">==5713== by 0x507FF: mm_device_create_modem (mm-device.c:411)</div><div class="">==5713== by 0x4D44B: device_support_check_ready (mm-base-manager.c:195)</div><div class="">==5713== by 0x4D2029F: g_task_return_now (gtask.c:1148)</div><div class="">==5713== by 0x4D20F27: g_task_return (gtask.c:1206)</div><div class="">==5713== by 0x4D214AF: g_task_return_pointer (gtask.c:1604)</div><div class="">==5713== </div><div class="">==5713== 7,180 bytes in 340 blocks are still reachable in loss record 1,180 of 1,184</div><div class="">==5713== at 0x4847DC8: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)</div><div class="">==5713== </div><div class="">==5713== 42,766 bytes in 232 blocks are still reachable in loss record 1,181 of 1,184</div><div class="">==5713== at 0x484AB84: realloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)</div><div class="">==5713== </div><div class="">==5713== 81,777 bytes in 2,312 blocks are still reachable in loss record 1,182 of 1,184</div><div class="">==5713== at 0x4847EB4: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)</div><div class="">==5713== </div><div class="">==5713== 101,244 bytes in 1,709 blocks are still reachable in loss record 1,183 of 1,184</div><div class="">==5713== at 0x484A904: calloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)</div><div class="">==5713== </div><div class="">==5713== 128,358 (128,324 direct, 34 indirect) bytes in 4,583 blocks are definitely lost in loss record 1,184 of 1,184</div><div class="">==5713== at 0x4847EB4: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)</div><div class="">==5713== </div><div class="">==5713== LEAK SUMMARY:</div><div class="">==5713== definitely lost: 128,348 bytes in 4,584 blocks</div><div class="">==5713== indirectly lost: 4,056 bytes in 120 blocks</div><div class="">==5713== possibly lost: 1,823 bytes in 33 blocks</div><div class="">==5713== still reachable: 277,019 bytes in 5,789 blocks</div><div class="">==5713== of which reachable via heuristic:</div><div class="">==5713== newarray : 5,736 bytes in 164 blocks</div><div class="">==5713== suppressed: 0 bytes in 0 blocks</div><div class="">==5713== </div><div class="">==5713== For lists of detected and suppressed errors, rerun with: -s</div><div class="">==5713== ERROR SUMMARY: 6 errors from 6 contexts (suppressed: 0 from 0)</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">It almost looks like the QMI messages, containing NMEA lines, are being stored in memory but never released. With this, we think that the leak is somewhere in the libmm-glib libraries, but we are not able to give you a good stack trace of that, because we are not able to compile the libmm-glib libraries with debug symbols. </div><div class="">This is an issue on our side with Buildroot and it’s way of building packages.</div><div class=""><br class=""></div><div class="">Hopefully this information is useful,</div><div class=""><br class=""></div><div class="">Currently used versions:</div><div class="">ModemManager: v1.12.2</div><div class="">libqmi: v1.24.0</div><div class="">libglib2: v2.56</div><div class=""><br class=""></div><div class=""><div dir="ltr" class=""><!-- signature open -->Geert Lens<!-- signature close --></div><div dir="ltr" class=""><br class=""><blockquote type="cite" class="">On 9 Jan 2020, at 15:25, Aleksander Morgado <<a href="mailto:aleksander@aleksander.es" class="">aleksander@aleksander.es</a>> wrote:<br class=""><br class=""></blockquote></div></div></div></div></div></div></body></html>