From: Denis Kenzior <denkenz@gmail.com>
To: ell@lists.01.org
Subject: ell/main.c Memory leak
Date: Fri, 03 Jun 2016 16:09:55 -0500 [thread overview]
Message-ID: <5751F223.6070901@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 4930 bytes --]
This is from iwd:
[DBUS] > 6c 04 01 01 98 00 00 00 04 00 00 00 68 00 00 00 l...........h...
[DBUS] 01 01 6f 00 01 00 00 00 2f 00 00 00 00 00 00 00 ..o...../.......
[DBUS] 03 01 73 00 0f 00 00 00 49 6e 74 65 72 66 61 63 ..s.....Interfac
[DBUS] 65 73 41 64 64 65 64 00 02 01 73 00 22 00 00 00 esAdded...s."...
[DBUS] 6f 72 67 2e 66 72 65 65 64 65 73 6b 74 6f 70 2e org.freedesktop.
[DBUS] 44 42 75 73 2e 4f 62 6a 65 63 74 4d 61 6e 61 67 DBus.ObjectManag
[DBUS] 65 72 00 00 00 00 00 00 08 01 67 00 0a 6f 61 7b er........g..oa{
[DBUS] 73 61 7b 73 76 7d 7d 00 sa{sv}}.
[DBUS] 02 00 00 00 2f 33 00 00 88 00 00 00 00 00 00 00 ..../3..........
[DBUS] 16 00 00 00 6e 65 74 2e 63 6f 6e 6e 6d 61 6e 2e ....net.connman.
[DBUS] 69 77 64 2e 44 65 76 69 63 65 00 00 33 00 00 00 iwd.Device..3...
[DBUS] 04 00 00 00 4e 61 6d 65 00 01 73 00 06 00 00 00 ....Name..s.....
[DBUS] 77 6c 70 32 73 30 00 00 07 00 00 00 41 64 64 72 wlp2s0......Addr
[DBUS] 65 73 73 00 01 73 00 00 06 00 00 00 a0 a8 cd 1c ess..s..........
[DBUS] 7e c9 00 00 00 00 00 00 27 00 00 00 6e 65 74 2e ~.......'...net.
[DBUS] 63 6f 6e 6e 6d 61 6e 2e 69 77 64 2e 57 69 46 69 connman.iwd.WiFi
[DBUS] 53 69 6d 70 6c 65 43 6f 6e 66 69 67 75 72 61 74 SimpleConfigurat
[DBUS] 69 6f 6e 00 00 00 00 00 ion.....
src/scan.c:scan_notify() Scan notification 33
[DBUS] disconnect
D-Bus disconnected, quitting...
src/eap.c:__eap_method_disable()
src/eap.c:eap_md5_exit()
src/eap-tls.c:eap_tls_exit()
src/eap-ttls.c:eap_ttls_exit()
src/main.c:nl80211_vanished() Lost nl80211 interface
src/wsc.c:wsc_exit()
src/scan.c:scan_exit()
src/scan.c:scan_context_free() sc: 0x53f4690
src/netdev.c:netdev_free() Freeing netdev wlp2s0[3]
src/netdev.c:netdev_exit() Closing route netlink socket
src/wiphy.c:wiphy_free() Freeing wiphy phy0
src/dbus.c:dbus_exit()
==11733==
==11733== HEAP SUMMARY:
==11733== in use at exit: 1,048 bytes in 2 blocks
==11733== total heap usage: 759 allocs, 757 frees, 88,760 bytes allocated
==11733==
==11733== 24 bytes in 1 blocks are still reachable in loss record 1 of 2
==11733== at 0x4C2C970: malloc (vg_replace_malloc.c:296)
==11733== by 0x41CA37: l_malloc (util.c:62)
==11733== by 0x41DE00: l_queue_new (queue.c:63)
==11733== by 0x422B9D: create_epoll (main.c:102)
==11733== by 0x422B9D: idle_add (main.c:263)
==11733== by 0x42361A: l_idle_create (idle.c:108)
==11733== by 0x4397AF: schedule_emit_signals (dbus-service.c:1081)
==11733== by 0x43A6EE: _dbus_object_tree_remove_interface
(dbus-service.c:1503)
==11733== by 0x439F45: check_interface_used (dbus-service.c:1306)
==11733== by 0x41F342: l_hashmap_foreach (hashmap.c:532)
==11733== by 0x439FBC: _dbus_object_tree_unregister_interface
(dbus-service.c:1320)
==11733== by 0x42CC6B: l_dbus_unregister_interface (dbus.c:1715)
==11733== by 0x418BE9: wsc_exit (wsc.c:341)
==11733==
==11733== 1,024 bytes in 1 blocks are still reachable in loss record 2 of 2
==11733== at 0x4C2C970: malloc (vg_replace_malloc.c:296)
==11733== by 0x422B85: create_epoll (main.c:98)
==11733== by 0x422B85: idle_add (main.c:263)
==11733== by 0x42361A: l_idle_create (idle.c:108)
==11733== by 0x4397AF: schedule_emit_signals (dbus-service.c:1081)
==11733== by 0x43A6EE: _dbus_object_tree_remove_interface
(dbus-service.c:1503)
==11733== by 0x439F45: check_interface_used (dbus-service.c:1306)
==11733== by 0x41F342: l_hashmap_foreach (hashmap.c:532)
==11733== by 0x439FBC: _dbus_object_tree_unregister_interface
(dbus-service.c:1320)
==11733== by 0x42CC6B: l_dbus_unregister_interface (dbus.c:1715)
==11733== by 0x418BE9: wsc_exit (wsc.c:341)
==11733== by 0x4029D3: nl80211_vanished (main.c:117)
==11733== by 0x428D49: l_genl_family_unref (genl.c:1057)
==11733==
==11733== LEAK SUMMARY:
==11733== definitely lost: 0 bytes in 0 blocks
==11733== indirectly lost: 0 bytes in 0 blocks
==11733== possibly lost: 0 bytes in 0 blocks
==11733== still reachable: 1,048 bytes in 2 blocks
==11733== suppressed: 0 bytes in 0 blocks
This leak happens in create_epoll(). The sequence of events is a bit
bizarre:
1. We send an invalid signal
2. DBus detects that and kills our connection
3. l_main_quit is called, which frees all main event loop resources
4. We start tearing down the rest of the daemon
a) At some point we unregister some interfaces
b) ObjectManager schedules the transmission of a signal
c) idle_create gets called, which calls create_epoll()
5. DBus is destroyed, which removes the idle source in 4c
Unfortunately at this point, nothing actually frees the resources
created by create_epoll().
I'm thinking l_main_run needs to be split up into l_main_new, l_main_run
and l_main_destroy.
Thoughts?
Regards,
-Denis
next reply other threads:[~2016-06-03 21:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-03 21:09 Denis Kenzior [this message]
2016-06-03 22:05 ` ell/main.c Memory leak Andrzej Zaborowski
2016-06-03 22:16 ` Denis Kenzior
2016-06-03 22:08 ` Mat Martineau
2016-06-03 22:25 ` Denis Kenzior
2016-06-03 23:17 ` Mat Martineau
2016-06-03 23:56 ` Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5751F223.6070901@gmail.com \
--to=denkenz@gmail.com \
--cc=ell@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.