jolly has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36078?usp=email )
Change subject: examples/stream-{server,client}: Generate talloc report on SIGUSR1 ......................................................................
examples/stream-{server,client}: Generate talloc report on SIGUSR1
This can help with memleak debugging.
Change-Id: Ia16632602b937db88e2da2b053192887bdb8a986 --- M examples/stream-client.c M examples/stream-server.c 2 files changed, 33 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified dexter: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve jolly: Looks good to me, approved
diff --git a/examples/stream-client.c b/examples/stream-client.c index 535804e..da90e8c 100644 --- a/examples/stream-client.c +++ b/examples/stream-client.c @@ -90,6 +90,15 @@ return 0; }
+static void signal_handler(int signum) +{ + switch (signum) { + case SIGUSR1: + talloc_report_full(tall_test, stdout); + break; + } +} + int main(int argc, char **argv) { struct osmo_fd *kbd_ofd; @@ -110,6 +119,8 @@ } }
+ signal(SIGUSR1, &signal_handler); + tall_test = talloc_named_const(NULL, 1, "osmo_stream_cli_test"); msgb_talloc_ctx_init(tall_test, 0); osmo_init_logging2(tall_test, &osmo_stream_cli_test_log_info); diff --git a/examples/stream-server.c b/examples/stream-server.c index bfbde6d..1cd3517 100644 --- a/examples/stream-server.c +++ b/examples/stream-server.c @@ -117,6 +117,15 @@ return 0; }
+static void signal_handler(int signum) +{ + switch (signum) { + case SIGUSR1: + talloc_report(tall_test, stderr); + break; + } +} + int main(int argc, char **argv) { struct osmo_fd *kbd_ofd; @@ -137,6 +146,8 @@ } }
+ signal(SIGUSR1, &signal_handler); + tall_test = talloc_named_const(NULL, 1, "osmo_stream_srv_test"); msgb_talloc_ctx_init(tall_test, 0); osmo_init_logging2(tall_test, &osmo_stream_srv_test_log_info);