<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:等线;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"\@等线";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
font-size:10.5pt;
font-family:等线;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
text-indent:21.0pt;
font-size:10.5pt;
font-family:等线;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:等线;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:等线;}
/* Page Definitions */
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:10299234;
mso-list-type:hybrid;
mso-list-template-ids:-1353542640 1699516576 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:18.0pt;
text-indent:-18.0pt;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-text:"%2\)";
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:42.0pt;
text-indent:-21.0pt;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:63.0pt;
text-indent:-21.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:84.0pt;
text-indent:-21.0pt;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-text:"%5\)";
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:105.0pt;
text-indent:-21.0pt;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:126.0pt;
text-indent:-21.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:147.0pt;
text-indent:-21.0pt;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-text:"%8\)";
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:168.0pt;
text-indent:-21.0pt;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:189.0pt;
text-indent:-21.0pt;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ZH-CN" link="#0563C1" vlink="#954F72" style="text-justify-trim:punctuation">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi all,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">This is Oona, a junior software engineer. I send this email to ask your help about my gstreamer application:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Recently, I met a <b>memory leak problem </b>on TX1 platform, when my gstreamer application tried to reconnect to the camera by rtsp.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Moreover, the tegra I’m using is:<o:p></o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US"># R28 (release), REVISION: 2.0, GCID: 10567845, BOARD: t210ref, EABI: aarch64, DATE: Fri Mar 2 04:58:16 UTC 2018<o:p></o:p></span></b></p>
<p class="MsoNormal"><span lang="EN-US">Gstreamer is:<o:p></o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US">gst-inspect-1.0 version 1.8.1<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span lang="EN-US">GStreamer 1.8.3<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span lang="EN-US">https://launchpad.net/distros/ubuntu/+source/gstreamer1.0<o:p></o:p></span></b></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Problem Details:<o:p></o:p></span></p>
<p class="MsoListParagraph" style="margin-left:18.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo1">
<![if !supportLists]><span lang="EN-US"><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span lang="EN-US">The application will call gst_init() at the very first, then builds pipleline as “<u>rtspsrc location=rtsp://${usrname}:${pwd}@${ip}:${port}/cam/realmonitor?channel=1&subtype=0 protocols=tcp ! rtph264depay !
h264parse ! omxh264dec ! video/x-raw, format=NV12 ! appsink sync=false async=false name=appsink1</u>”. As expected, it gets data from camera.
<b>By `top` commands, I can see its occupied-memory is ~108M;</b><o:p></o:p></span></p>
<p class="MsoNormal">(<span lang="EN-US">disable ${ip}</span>)<span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoListParagraph" style="margin-left:18.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo1">
<![if !supportLists]><span lang="EN-US"><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span lang="EN-US">Of course, the application fails to get data. And the application is trying to reconnect the pipeline periodically.
<b>It is still occupied ~108M;</b><o:p></o:p></span></p>
<p class="MsoNormal">(<span lang="EN-US">enable ${ip}</span>)<span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoListParagraph" style="margin-left:18.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo1">
<![if !supportLists]><span lang="EN-US"><span style="mso-list:Ignore">3.<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span lang="EN-US">The application succeeds to get video again. However, the memory rises to
<b>~180M!</b><o:p></o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US">After trying 2,3 for times, I finds that: the memory will increase by -80M each time when it succeed in reconnection.
<o:p></o:p></span></b></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The following code segment is the reconnection (first close() then open()). I think I have unref all the resources in close(), in addition, I unref gst-sample, gst-message in time.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">```<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">int GSTCameraMini::open() {<br>
this->m_camera_state = CAM_INIT; <br>
this -> build_pipeline(); <br>
gst_element_set_state(this -> pipeline, GST_STATE_PLAYING);<br>
return 0;<br>
}<br>
<br>
int GSTCameraMini::close() {<br>
this->m_camera_state = CAM_OFFLINE; <br>
gst_element_set_state(this -> pipeline, GST_STATE_NULL);<br>
// unref appsink<br>
gst_object_unref(G_OBJECT(this -> appsink));<br>
// unref bus<br>
gst_object_unref(G_OBJECT(this -> bus));<br>
// unref pipeline<br>
gst_object_unref(G_OBJECT(this -> pipeline)); <br>
return 0;<br>
}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">```<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I have no idea where goes wrong, and this problem makes me headache for a long time. It is a bug from gstreamer or other?
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Sincerely looking forward to your reply.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Best & Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Oona <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
</body>
</html>