<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Those are freed on the other end of the queue.<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 18, 2018, at 5:03 PM, Mody, Darshan (Darshan) <<a href="mailto:darshanmody@avaya.com" class="">darshanmody@avaya.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">We are looking into the memory leaks. We are heavily using BGAPI with lua interface.<o:p class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">We are currently closely looking into switch_event_queue_dispatch_event method. We don’t get why are we setting the values as NULL and not destroying the event.<o:p class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><b class=""><span style="font-size: 10pt; font-family: monospace; color: rgb(127, 0, 85);" class="">static</span></b><span style="font-size: 10pt; font-family: monospace;" class=""><span class="Apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: monospace; color: rgb(0, 80, 50);" class="">switch_status_t</span><span style="font-size: 10pt; font-family: monospace;" class=""><span class="Apple-converted-space"> </span><b class="">switch_event_queue_dispatch_event</b>(</span><span style="font-size: 10pt; font-family: monospace; color: rgb(0, 80, 50);" class="">switch_event_t</span><span style="font-size: 10pt; font-family: monospace;" class=""><span class="Apple-converted-space"> </span>**eventp)</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class="">{</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> <span class="Apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: monospace; color: rgb(0, 80, 50);" class="">switch_event_t</span><span style="font-size: 10pt; font-family: monospace;" class=""><span class="Apple-converted-space"> </span>*event = *eventp;</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> <span class="Apple-converted-space"> </span></span><b class=""><span style="font-size: 10pt; font-family: monospace; color: rgb(127, 0, 85);" class="">if</span></b><span style="font-size: 10pt; font-family: monospace;" class=""><span class="Apple-converted-space"> </span>(!SYSTEM_RUNNING) {</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> <span class="Apple-converted-space"> </span></span><b class=""><span style="font-size: 10pt; font-family: monospace; color: rgb(127, 0, 85);" class="">return</span></b><span style="font-size: 10pt; font-family: monospace;" class=""><span class="Apple-converted-space"> </span></span><i class=""><span style="font-size: 10pt; font-family: monospace; color: rgb(0, 0, 192);" class="">SWITCH_STATUS_FALSE</span></i><span style="font-size: 10pt; font-family: monospace;" class="">;</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> }</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> <span class="Apple-converted-space"> </span></span><b class=""><span style="font-size: 10pt; font-family: monospace; color: rgb(127, 0, 85);" class="">while</span></b><span style="font-size: 10pt; font-family: monospace;" class=""><span class="Apple-converted-space"> </span>(event) {</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> <span class="Apple-converted-space"> </span></span><b class=""><span style="font-size: 10pt; font-family: monospace; color: rgb(127, 0, 85);" class="">int</span></b><span style="font-size: 10pt; font-family: monospace;" class=""><span class="Apple-converted-space"> </span>launch = 0;</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> switch_mutex_lock(EVENT_QUEUE_MUTEX);</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> <span class="Apple-converted-space"> </span></span><b class=""><span style="font-size: 10pt; font-family: monospace; color: rgb(127, 0, 85);" class="">if</span></b><span style="font-size: 10pt; font-family: monospace;" class=""><span class="Apple-converted-space"> </span>(!PENDING && switch_queue_size(EVENT_DISPATCH_QUEUE) > (</span><b class=""><span style="font-size: 10pt; font-family: monospace; color: rgb(127, 0, 85);" class="">unsigned</span></b><span style="font-size: 10pt; font-family: monospace;" class=""></span><b class=""><span style="font-size: 10pt; font-family: monospace; color: rgb(127, 0, 85);" class="">int</span></b><span style="font-size: 10pt; font-family: monospace;" class="">)(DISPATCH_QUEUE_LEN * DISPATCH_THREAD_COUNT)) {</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> <span class="Apple-converted-space"> </span></span><b class=""><span style="font-size: 10pt; font-family: monospace; color: rgb(127, 0, 85);" class="">if</span></b><span style="font-size: 10pt; font-family: monospace;" class=""><span class="Apple-converted-space"> </span>(SOFT_MAX_DISPATCH + 1 < MAX_DISPATCH) {</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> launch++;</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> PENDING++;</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> }</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> }</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> switch_mutex_unlock(EVENT_QUEUE_MUTEX);</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> <span class="Apple-converted-space"> </span></span><b class=""><span style="font-size: 10pt; font-family: monospace; color: rgb(127, 0, 85);" class="">if</span></b><span style="font-size: 10pt; font-family: monospace;" class=""><span class="Apple-converted-space"> </span>(launch) {</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> <span class="Apple-converted-space"> </span></span><b class=""><span style="font-size: 10pt; font-family: monospace; color: rgb(127, 0, 85);" class="">if</span></b><span style="font-size: 10pt; font-family: monospace;" class=""><span class="Apple-converted-space"> </span>(SOFT_MAX_DISPATCH + 1 < MAX_DISPATCH) {</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> <span style="background-color: silver; background-position: initial initial; background-repeat: initial initial;" class="">switch_event_launch_dispatch_threads</span>(SOFT_MAX_DISPATCH + 1);</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> }</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> switch_mutex_lock(EVENT_QUEUE_MUTEX);</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> PENDING--;</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> switch_mutex_unlock(EVENT_QUEUE_MUTEX);</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> }</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> <span class="Apple-converted-space"> </span><span style="background-color: yellow; background-position: initial initial; background-repeat: initial initial;" class="">*eventp = NULL; <span class="Apple-converted-space"> </span></span></span><span style="font-size: 10pt; font-family: monospace; background-color: yellow; background-position: initial initial; background-repeat: initial initial;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace; background-color: yellow;" class=""> switch_queue_push(EVENT_DISPATCH_QUEUE, event);<span class="Apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: Wingdings; background-color: yellow;" class="">ß</span><span style="font-size: 10pt; font-family: monospace; background-color: yellow;" class=""><span class="Apple-converted-space"> </span>We are pushing the event in the queue</span><span style="font-size: 10pt; font-family: monospace; background-color: yellow; background-position: initial initial; background-repeat: initial initial;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace; background-color: yellow;" class=""> event = NULL;</span><span style="font-size: 10pt; font-family: monospace;" class=""> <span class="Apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: Wingdings;" class="">ß</span><span style="font-size: 10pt; font-family: monospace;" class=""><span class="Apple-converted-space"> </span>we are just setting this value as NULL. Shouldn’t we destroy the event using switch_event_destroy method?</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> }</span><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""> <span class="Apple-converted-space"> </span></span><b class=""><span style="font-size: 10pt; font-family: monospace; color: rgb(127, 0, 85);" class="">return</span></b><span style="font-size: 10pt; font-family: monospace;" class=""><span class="Apple-converted-space"> </span></span><i class=""><span style="font-size: 10pt; font-family: monospace; color: rgb(0, 0, 192);" class="">SWITCH_STATUS_SUCCESS</span></i><span style="font-size: 10pt; font-family: monospace;" class="">;<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span style="font-size: 10pt; font-family: monospace;" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Help in this regard is highly appreciated.<o:p class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div></div></div></blockquote></div><br class=""></body></html>