[Live-devel] Memory leaks ?

kamil kamildobk at poczta.onet.pl
Fri Sep 9 11:19:37 PDT 2005


>
>>2. I run TCP tunneled RTP by: openRTSP.exe -t -e 5 
>>rtsp://192.168.7.199/mpeg4/1/media.amp
>>
>>'socketTable' is not removed. It is deleted in ~RCTPInstance(), but next 
>>it is immediately created again in ~MuliFramedRTPSource, and not deleted 
>>again because it is empty.
>>You create 'socketTable' on request in socketHashTable(), but delete it 
>>only in removeSocketDescriptor() which is error-prone as 'socketTable' is 
>>created initially empty, so removeSocketDescriptor() will not be called in 
>>every situation.
>
> I don't follow this.  "removeSocketDescription()" is called by 
> "SocketDescriptor::deregisterRTPInterface()", which in turn is called by 
> "RTPInterface::stopNetworkReading()", which in turn is called by both 
> "~RTCPInstance()" and "~MultiFramedRTPSource()".  So, as long as the 
> "RTCPInstance" and "MultiFramedRTPSource" objects are reclaimed (using 
> "Medium::close()", the socket table should (eventually) get removed.
>

I noticed the following effect:

1.
~RCTPInstance() -> stopNetworkReading()
2.
 lookupSocketDescriptor() -> socketHashTable()
3.
// the following calls remove the last socket and delete empty 
socketHashTable
 if ( socketDescriptor != NULL ) { deregisterRTPInterface() -> 
removeSocketDescription() -> delete table; }
4.
~MultiFramedRTPSource() -> stopNetworkReading()
5.
// because socketHashTable was deleted in ~RCTPInstance it creates a new 
empty socketHashTable
 lookupSocketDescriptor() -> socketHashTable() -> HashTable::create()
 6.
// because socketHashTable is empty lookupSocketDescriptor() returns NULL
// and socketDescriptor has NULL value
 if ( socketDescriptor != NULL ) { // nothing is called here }
7.
// the empty socketHashTable still exists here !
// and is not deleted


It looks like RCTPInstance() and ~MultiFramedRTPSource share the same 
socket, because socket hash table is empty after deleting ~RCTPInstance.

> (In any case, it's only a small piece of memory that's allocated only 
> once, so no big deal...)
>

but it prevents the UsageEnvironment from being deleted, which is user 
defined class :( 


_________________________________________________________________
List sprawdzony skanerem poczty mks_vir ( http://www.mks.com.pl )


More information about the live-devel mailing list