[Live-devel] memory leak in MultiFrameRTPSource on fSavedPacket

Ross Finlayson finlayson at live555.com
Fri Oct 6 13:45:50 PDT 2006


>To fix this we just removed completelety fSavedPacket from the
>code, and it works. Can you tell me what is the goal of this
>pointer.

"fSavedPacket" is used to optimize the common case where packets 
arrive in order, without loss.  It is a preallocated buffer that is 
kept around to avoid having to do a "new"/"delete" - for each 
incoming packet - in this common case.  (See the code for 
"getFreePacket()" and "freePacket()".)

>  Can't we simply remove it ?

Yes, but you then lose the optimization.

>  I attached the valgrind log (to show you the memory leak)

I think "valgrind" may be mistaken in this case.  I don't think there 
is a memory leak here.  (The "fSavedPacket" buffer is allocated only 
once, when the "MultiFramedRTPSource" object first starts receiving 
data, and is deleted when the "MultiFramedRTPSource" object is 
deleted.)
-- 

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


More information about the live-devel mailing list