> On Jan 10, 2022, at 7:54 PM, Ba Jinsheng <[email protected]> wrote:
>
> I am not sure if the design is like this, but it does incur unstopping memory
> increasing.
>
>
> OnDemandServerMediaSubsession::getStreamParameters() in
> liveMedia/OnDemandServerMediaSubsession.cpp
> This function will allocate a new StreamState object and append it to the
> global array: fStreamStates.
> Within the new StreamState, some objects are allocated, such as rtcpGroupsock.
> However these new allocated memory seem only be freed by
> streamState->reclaim(); in afterPlayingStreamState() function.
> And this function seems not be executed.
“StreamState::reclaim()” is also called by the “StreamState” destructor, which
is called by "OnDemandServerMediaSubsession::deleteStream()”.
If a client repeatedly sends RTSP “SETUP” commands - with different session ids
- to the server, then the server will, of course, allocate state for each
session, in anticipation of the client later sending “PLAY” commands for each
session. The server will reclaim the state for each session if either:
- the client sends a RTSP “TEARDOWN” request for this session, or
- there is no client activity (RTSP or RTCP) for the session after a
timeout interval (by default, 60 seconds). If this happens, then the
"RTSPServer::RTSPClientSession” object (for the session) will be deleted, which
will call "RTSPServer::RTSPClientSession::reclaimStreamStates()”, which will
call "OnDemandServerMediaSubsession::deleteStream()”, which will delete the
“StreamState” object (as noted above).
So I’m not seeing any memory leak here. If you wait 60 seconds after each RTSP
session is “SETUP”, then the “StreamState” objects should get deleted (unless
your client is doing other RTSP things with each session).
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
_______________________________________________
live-devel mailing list
[email protected]
http://lists.live555.com/mailman/listinfo/live-devel