Project

General

Profile

Actions

Bug #2925

closed

Unfreed 'Mobile Primitive' chunks

Added by fixeria about 6 years ago. Updated about 6 years ago.

Status:
Resolved
Priority:
Low
Assignee:
Category:
OsmocomBB mobile (host)
Target version:
-
Start date:
02/10/2018
Due date:
% Done:

100%

Resolution:
Spec Reference:

Description

The recent LUA integration code introduced the following
memory chunks unfreed at exit of mobile:

full talloc report on 'layer2 context' (total   8121 bytes in   9 blocks)
 msgb   contains   8120 bytes in   8 blocks (ref 0) 0x259e4d0
  Mobile Primitive   contains   1160 bytes in   1 blocks (ref 0) 0x2651510
  Mobile Primitive   contains   1160 bytes in   1 blocks (ref 0) 0x2652400
  Mobile Primitive   contains   1160 bytes in   1 blocks (ref 0) 0x2650720
  Mobile Primitive   contains   1160 bytes in   1 blocks (ref 0) 0x264fc10
  Mobile Primitive   contains   1160 bytes in   1 blocks (ref 0) 0x2651f10
  Mobile Primitive   contains   1160 bytes in   1 blocks (ref 0) 0x2651a20
  Mobile Primitive   contains   1160 bytes in   1 blocks (ref 0) 0x264f690

Isn't this feature optional?
Do we really need to keep that chunks all time?

Actions #1

Updated by fixeria about 6 years ago

As it turns out, a 'Mobile Primitive' is being allocated by mobile_prim_alloc()
on each Location Update request, but not freed...

Actions #2

Updated by zecke about 6 years ago

Argh... I didn't think this through when going from stack based allocation to msgb.

I am almost away for today... can you try this? Will push it to gerrit tomorrow.

diff --git a/src/host/layer23/src/mobile/primitives.c b/src/host/layer23/src/mobile/primitives.c
index c3f28a5a..2d3e4ad9 100644
--- a/src/host/layer23/src/mobile/primitives.c
+++ b/src/host/layer23/src/mobile/primitives.c
@@ -107,6 +107,7 @@ static void dispatch(struct osmocom_ms *ms, struct mobile_prim *prim)
                if (intf->ms == ms)
                        intf->indication(intf, prim);
        }
+       msgb_free(prim->hdr.msg);
 }

 void mobile_prim_ntfy_started(struct osmocom_ms *ms, bool started)
diff --git a/src/host/layer23/src/mobile/script_lua.c b/src/host/layer23/src/mobile/script_lua.c
index 9b256d3a..8d3064d0 100644
--- a/src/host/layer23/src/mobile/script_lua.c
+++ b/src/host/layer23/src/mobile/script_lua.c
@@ -451,8 +451,6 @@ static void lua_prim_ind(struct mobile_prim_intf *intf, struct mobile_prim *prim
        default:
                LOGP(DLUA, LOGL_ERROR, "Unknown primitive: %d\n", OSMO_PRIM_HDR(&prim->hdr));
        };
-
-       msgb_free(prim->hdr.msg);
 }

 /*
Actions #3

Updated by fixeria about 6 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)