<!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] (no subject)</title></head><body>
<blockquote type="cite" cite><tt> 1.
There are two memory leaks here.I write my programs following the
test***streamer and free the memory as the following:<br>
if (sessionState.sink != NULL)
sessionState.sink->stopPlaying();<br>
<br>
Medium::close(sessionState.rtcpInstance);<x-tab>
</x-tab><br>
Medium::close(sessionState.sink);<br>
Medium::close(sessionState.source);<br>
<x-tab> </x-tab><br>
Medium::close(sms);<br>
Medium::close(rtspServer);<br>
delete sessionState.rtpGroupsock;<br>
<br>
delete sessionState.rtcpGroupsock;<br>
<br>
if(scheduler) delete
scheduler;</tt></blockquote>
<blockquote type="cite" cite><tt>
if(env) env->reclaim();</tt></blockquote>
<div><br></div>
<div>What you are doing is correct (although, if you are planning to
rerun the same code once again, you could reuse the same
"UsageEnvironment" and "TaskScheduler" objects;
i.e., you would not need to delete them). However, why don't you
just run your code in its own process (i.e., as a separate
application)? That way, all of the memory that you allocated
will automatically be reclaimed.</div>
<div><br></div>
<blockquote type="cite" cite><tt><br>
If I just create the
sinkĊAsourcĊArtspserver etc and don't startplaying,there will be no
memory leak.But if I add startplaying,after I close the server,there
will be two memory leaks :<br>
<br>
<br>
Detected memory leaks!<br>
Dumping objects -><br>
{594258} normal block at 0x003CC818, 32 bytes long.<br>
Data: <l
G
> 6C 0F 47 00 00 00 00 00 00 00 00 00 00 00 00 00<br>
{594245} normal block at 0x00B49008, 32 bytes long.<br>
<br>
Data: <l
G
> 6C 0F 47 00 00 00 00 00 00 00 00 00 00 00 00 00<br>
<br>
I am sorry that It may be difficult for
you to find out what resulted in this,but can you give me some
suggestion?</tt></blockquote>
<div><br></div>
<div>Does 64 bytes of extra memory get allocated each time you run
your code (i.e., in a loop), or does only 64 extra bytes get
allocated, no matter how many times you run your code? If it's
the latter case, then the problem doesn't seem serious.</div>
<div><br></div>
<div>However, you may be able to use "valgrind" (if you're
running on a Unix or Linux system) to help track down where this
memory allocation is coming from.</div>
<div><br></div>
<blockquote type="cite" cite><tt><br>
2.Sometimes esapcically after I restart
teh server,when I start my server and use VLC to play th stream,the
server receives the "DECRIBE"ĊA"SETUP" and
"PLAY"command ok, but VLC just doesn't play the stream and
it tears down a few seconds later.I don't know the reason.I use
openRTSP and try to save the stream into a file.Things are the
same.The connection between the RTSP server and openRTSP is ok,but
openRTSP can't receive any data,so the file is empty. Then I restart
the server for one or more times,everything goes all right.</tt><br>
<tt></tt></blockquote>
<blockquote type="cite" cite><tt>
I rarely run into this problem with testprogs or
OnDemandRTSPServer.Therefore,there must be some reason that I have not
found in my program.Would you please help me?</tt></blockquote>
<div><br>
<br>
</div>
<div>Unfortunately not; I can (in general) help only with the
unmodified supplied code.</div>
<div><br></div>
<x-sigsep><pre>--
</pre></x-sigsep>
<div><br>
Ross Finlayson<br>
Live Networks, Inc.<br>
http://www.live555.com/</div>
</body>
</html>