<!doctype html public "-//W3C//DTD W3 HTML//EN">
<html><head><style type="text/css"><!--
blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 }
 --></style><title>Re: [Live-devel] Memory leak on closing client and
session</title></head><body>
<blockquote type="cite" cite><font face="Arial" size="-1">I created
simple video stream (mpeg4) and I'm using FileSink as default
sink.</font></blockquote>
<blockquote type="cite" cite><font face="Arial" size="-1">Everything
is fine until I try to end all sessions and streaming. Everything
ends</font></blockquote>
<blockquote type="cite" cite><font face="Arial" size="-1">and every
subsession and session is closed but there still apears to be memory
leak</font></blockquote>
<blockquote type="cite" cite><font face="Arial"
size="-1">somwhere.</font></blockquote>
<blockquote type="cite" cite>&nbsp;</blockquote>
<blockquote type="cite" cite><font face="Arial" size="-1">I'm opening
the stream like this:</font></blockquote>
<blockquote type="cite" cite><font face="Arial" size="-1">1. Get
discription</font></blockquote>
<blockquote type="cite" cite><font face="Arial" size="-1">2. Create
new media session</font></blockquote>
<blockquote type="cite" cite><font face="Arial" size="-1">3. Init
media sub sessions</font></blockquote>
<blockquote type="cite" cite><font face="Arial" size="-1">4.
setupMediaSubsession(subsession)</font></blockquote>
<blockquote type="cite" cite><font face="Arial" size="-1">5. create
file sink</font></blockquote>
<blockquote type="cite" cite><font face="Arial" size="-1">6. Setting
subsession-&gt;sink = filesink;</font></blockquote>
<blockquote type="cite" cite><font face="Arial" size="-1">7.
subsession-&gt;sink-&gt;startPlauying(subsession-&gt;readSource,NULL,<span
></span>subsession);</font></blockquote>
<blockquote type="cite" cite><font face="Arial" size="-1">8.
rtspClient-&gt;playMediaSession(...);</font></blockquote>
<blockquote type="cite" cite>&nbsp;</blockquote>
<blockquote type="cite" cite><font face="Arial" size="-1">I'm ending
streams like this:</font></blockquote>
<blockquote type="cite" cite><font face="Arial"
size="-1">&nbsp;rtspClient_-&gt;teardownMediaSession(*mediaSession_);<br
>
&nbsp;<br>
&nbsp;MediaSubsessionIterator iter(*mediaSession_);<br>
&nbsp;MediaSubsession *subsession = iter.next();<br>
&nbsp;<br>
&nbsp;<br>
&nbsp;while (subsession != NULL)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
subsession-&gt;sink-&gt;stopPlaying();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Medium::close(subsession-&gt;sink);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; subsession-&gt;sink =
NULL;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; subsession =
iter.next();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;<br>
&nbsp;MediaSession::close(mediaSession_);<br>
&nbsp;mediaSession_ = NULL;</font></blockquote>
<blockquote type="cite" cite>&nbsp;</blockquote>
<blockquote type="cite" cite>&nbsp;</blockquote>
<blockquote type="cite" cite><font face="Arial" size="-1">Did I miss
something?</font></blockquote>
<div><br></div>
<div>You should also be closing (deleting) the &quot;RTSPClient&quot;
object.&nbsp; Plus, of course, the &quot;UsageEnvironment&quot; and
&quot;TaskScheduler&quot; objects, if you're not planning on using
them again.&nbsp; (In that case, though, you might as well just exit()
the process.)</div>
<x-sigsep><pre>-- 
</pre></x-sigsep>
<div><br>
Ross Finlayson<br>
Live Networks, Inc.<br>
http://www.live555.com/</div>
</body>
</html>