Hello Daniel,
Thank you for reply.

I haven't used event-route in this scenario.
When i fork parallel (without suspend/continue), memory leak does not happen. 

On Mon, Apr 24, 2017 at 5:44 PM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:

Hello,

there seem to be quite a lot of avps -- are you using an event_route block with avp variables inside?

Cheers,
Daniel


On 24.04.17 14:34, Julia Boudniatsky wrote:
Hello all,

I need to fork an incoming call to the second destination, after receiving 180 reply from the first destination.
I use kamailio version 4.4.5
It working fine, but with shared memory leak.
The script part:

       $avp(00x)=$_s(sip:$var(00x)@$si:$sp;user=phone);
       if(!is_known_dlg()){
                dlg_manage();
        }
        t_relay();
        append_branch("$avp(00x)");
        if(t_suspend()) {
                xlog("L_NOTICE","FORK: suspend transaction[$T(id_index):$T(id_label)]\r\n");
        }

onreply_route [REPLY_TO_SOURCE] {
if ($T_reply_code=="180") {
t_continue("$T(id_index)", "$T(id_label)", "RELAY_FORK");
}
}
route[RELAY_FORK] {
                $ru=$avp(00x);
                $avp(tu) = $_s(sip:$rU@$td;user=phone);
                uac_replace_to("$avp(tu)");
                remove_hf("Supported");
                xlog("L_NOTICE","RELAY_FORK : $rm CSeq[$hdr(CSeq)] branch[$T_branch_idx]\r\n");
                t_relay();
}

Please find the result of  kamcmd corex.shm_summary after 300 calls

Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status: summarizing all alloc'ed. fragments:
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=       176 bytes from dialog: dlg_profile.c: set_dlg_profile(574)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     3 size=       264 bytes from dialog: dlg_var.c: new_dlg_var(97)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     3 size=       152 bytes from dialog: dlg_hash.c: dlg_set_leg_info(526)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     3 size=       144 bytes from dialog: dlg_hash.c: dlg_set_leg_info(509)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     2 size=      1184 bytes from dialog: dlg_hash.c: build_new_dlg(441)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     3 size=        24 bytes from dialog: dlg_var.c: new_dlg_var(106)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     3 size=        24 bytes from dialog: dlg_var.c: new_dlg_var(116)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     3 size=        88 bytes from dialog: dlg_hash.c: dlg_set_leg_info(517)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=   337 size=    367448 bytes from tm: t_reply.c: relay_reply(1891)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=   334 size=    549312 bytes from tm: t_msgbuilder.c: build_local_reparse(344)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=   672 size=   1123536 bytes from core: msg_translator.c: build_req_buf_from_sip_req(2154)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=   337 size=    505048 bytes from core: sip_msg_clone.c: msg_lump_cloner(978)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=   331 size=     14784 bytes from tm: t_reply.c: update_totag_set(312)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=   340 size=   3566680 bytes from core: sip_msg_clone.c: sip_msg_shm_clone(494)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=   339 size=      5024 bytes from dialog: dlg_handlers.c: dlg_get_iuid_shm_clone(280)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=   337 size=   2528256 bytes from tm: h_table.c: build_cell(317)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=   331 size=     10096 bytes from tm: t_reply.c: update_totag_set(313)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=  2390 size=    315368 bytes from core: usr_avp.c: create_avp(175)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=     36480 bytes from core: counters.c: counters_prefork_init(207)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=     10944 bytes from sl: sl_stats.c: init_sl_stats_child(125)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=       512 bytes from tmx: tmx_pretran.c: tmx_init_pretran_table(90)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=     14592 bytes from tm: t_stats.c: init_tm_stats_child(60)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=      2736 bytes from kex: pkg_stats.c: pkg_proc_stats_init(79)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     3 size=        88 bytes from core: cfg/cfg_struct.c: cfg_clone_str(130)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=       648 bytes from core: cfg/cfg_struct.c: cfg_shmize(217)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: pt.c: init_pt(110)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: pt.c: init_pt(105)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=      7984 bytes from core: pt.c: init_pt(104)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=      8192 bytes from htable: ht_api.c: ht_init_tables(381)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from cfgutils: cfgutils.c: mod_init(935)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from cfgutils: cfgutils.c: mod_init(929)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from cfgutils: cfgutils.c: mod_init(921)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=    131088 bytes from dialog: dlg_hash.c: init_dlg_table(284)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from dialog: dlg_hash.c: init_dlg_table(276)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from dialog: dlg_hash.c: init_dlg_table(269)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from dialog: dlg_hash.c: init_dlg_table(264)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from dialog: dlg_timer.c: init_dlg_timer(57)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=        32 bytes from dialog: dlg_timer.c: init_dlg_timer(48)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=       312 bytes from dialog: dlg_profile.c: new_dlg_profile(187)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=       432 bytes from dispatcher: dispatch.c: reindex_dests(601)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=   678 size=     31456 bytes from tm: t_hooks.c: insert_tmcb(137)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     3 size=        32 bytes from dispatcher: dispatch.c: ds_set_attrs(235)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     3 size=        72 bytes from dispatcher: dispatch.c: add_dest2list(351)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     3 size=       360 bytes from core: timer.c: register_timer(1011)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=       840 bytes from dispatcher: dispatch.c: add_dest2list(325)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=        16 bytes from dispatcher: dispatch.c: init_data(204)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=        16 bytes from dispatcher: dispatch.c: init_data(195)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from dispatcher: dispatcher.c: ds_parse_reply_codes(1029)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from dispatcher: dispatcher.c: mod_init(309)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from dispatcher: dispatcher.c: mod_init(307)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from dispatcher: dispatch.c: ds_ping_active_init(102)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from sl: sl_funcs.c: sl_startup(83)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from sl: sl_stats.c: init_sl_stats(110)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=        16 bytes from tm: t_hooks.c: init_tmcb_lists(74)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=        16 bytes from tm: t_hooks.c: init_tmcb_lists(72)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=   2097152 bytes from tm: h_table.c: init_hash_table(467)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     3 size=        96 bytes from core: cfg/cfg_ctx.c: cfg_register_ctx(47)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: usr_avp.c: init_avps(90)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: usr_avp.c: init_avps(89)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=     16384 bytes from core: dst_blacklist.c: init_dst_blacklist(437)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: dst_blacklist.c: init_dst_blacklist(430)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     2 size=        96 bytes from core: timer.c: timer_alloc(514)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: dns_cache.c: init_dns_cache(366)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=     16384 bytes from core: dns_cache.c: init_dns_cache(358)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=        16 bytes from core: dns_cache.c: init_dns_cache(351)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: dns_cache.c: init_dns_cache(345)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: timer.c: init_timer(283)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=     16384 bytes from core: timer.c: init_timer(282)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: timer.c: init_timer(281)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: timer.c: init_timer(280)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: timer.c: init_timer(269)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: timer.c: init_timer(237)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=    278544 bytes from core: timer.c: init_timer(220)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: timer.c: init_timer(219)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: timer.c: init_timer(206)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=        64 bytes from core: cfg/cfg_struct.c: cfg_child_cb_new(830)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: cfg/cfg_struct.c: sr_cfg_init(361)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: cfg/cfg_struct.c: sr_cfg_init(354)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: cfg/cfg_struct.c: sr_cfg_init(347)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: cfg/cfg_struct.c: sr_cfg_init(335)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: cfg/cfg_struct.c: sr_cfg_init(323)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=       232 bytes from htable: ht_api.c: ht_add_table(278)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from pv: pv_shv.c: add_shvar(177)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=        64 bytes from pv: pv_shv.c: add_shvar(170)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=        80 bytes from pv: ../../lock_alloc.h: lock_set_alloc(70)
Apr 24 15:08:53 vm-tkamasy1 /usr/local/sbin/kamailio[2795]: WARNING: fm_status:  count=     1 size=         8 bytes from core: mem/shm.c: shm_core_lock_init(153)

Thank you for help.


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - May 22-24 (USA) - www.asipto.com
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users