This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. Change subject: VIRT-PHY: enable proper memory leak debugging ...................................................................... VIRT-PHY: enable proper memory leak debugging We make sure that all allocations are tracked back to one talloc root context, and install the usual SIGUSR1 handler to dump the talloc report. This enables us to do interactive debugging for memory leaks while virtphy is running. Change-Id: I73b3cf86eea5f56595c1b045cf0fde8035ff185a --- M src/host/virt_phy/src/virt_l1_sched_simple.c M src/host/virt_phy/src/virtphy.c 2 files changed, 26 insertions(+), 3 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/virt_phy/src/virt_l1_sched_simple.c b/src/host/virt_phy/src/virt_l1_sched_simple.c index 7d1cdd4..ba8298f 100644 --- a/src/host/virt_phy/src/virt_l1_sched_simple.c +++ b/src/host/virt_phy/src/virt_l1_sched_simple.c @@ -127,7 +127,7 @@ } if (!mi_fn) { /* list did not contain mframe item with needed fn */ - mi_fn = talloc_zero(NULL, struct virt_l1_sched_mframe_item); + mi_fn = talloc_zero(ms, struct virt_l1_sched_mframe_item); mi_fn->fn = fn; /* need to manually init the struct content.... no so happy */ mi_fn->tdma_item_list.prev = &mi_fn->tdma_item_list; diff --git a/src/host/virt_phy/src/virtphy.c b/src/host/virt_phy/src/virtphy.c index e0bee72..412b742 100644 --- a/src/host/virt_phy/src/virtphy.c +++ b/src/host/virt_phy/src/virtphy.c @@ -23,12 +23,14 @@ #include <osmocom/core/msgb.h> #include <osmocom/core/select.h> #include <osmocom/core/gsmtap.h> +#include <osmocom/core/application.h> #include <stdint.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <getopt.h> #include <errno.h> +#include <signal.h> #include <virtphy/virtual_um.h> #include <virtphy/l1ctl_sock.h> #include <virtphy/virt_l1_model.h> @@ -168,8 +170,29 @@ l1_model_ms_destroy(ms); } +static void *tall_vphy_ctx; + +static void signal_handler(int signum) +{ + LOGP(DMAIN, LOGL_NOTICE, "Signal %d received\n", signum); + + switch (signum) { + case SIGUSR1: + talloc_report_full(tall_vphy_ctx, stderr); + break; + default: + break; + } +} + int main(int argc, char *argv[]) { + tall_vphy_ctx = talloc_named_const(NULL, 1, "root"); + + msgb_talloc_ctx_init(tall_vphy_ctx, 0); + signal(SIGUSR1, &signal_handler); + osmo_init_ignore_signals(); + /* init loginfo */ handle_options(argc, argv); @@ -177,10 +200,10 @@ LOGP(DVIRPHY, LOGL_INFO, "Virtual physical layer starting up...\n"); - g_vphy.virt_um = virt_um_init(NULL, ul_tx_grp, port, dl_rx_grp, port, + g_vphy.virt_um = virt_um_init(tall_vphy_ctx, ul_tx_grp, port, dl_rx_grp, port, gsmtapl1_rx_from_virt_um_inst_cb); - g_vphy.l1ctl_sock = l1ctl_sock_init(NULL, l1ctl_sap_rx_from_l23_inst_cb, + g_vphy.l1ctl_sock = l1ctl_sock_init(tall_vphy_ctx, l1ctl_sap_rx_from_l23_inst_cb, l1ctl_accept_cb, l1ctl_close_cb, l1ctl_sock_path); g_vphy.virt_um->priv = g_vphy.l1ctl_sock; -- To view, visit https://gerrit.osmocom.org/3295 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I73b3cf86eea5f56595c1b045cf0fde8035ff185a Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Owner: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder