1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

fix memory leak at source. 2.0.214

This commit is contained in:
winlin 2016-09-05 14:13:37 +08:00
parent 6ec60b0a21
commit c7b97aa1c3
8 changed files with 103 additions and 4 deletions

View file

@ -439,6 +439,9 @@ public:
*/
static void dispose_all();
static int cycle_all();
private:
static int do_cycle_all();
public:
/**
* when system exit, destroy the sources,
* for gmc to analysis mem leaks.
@ -451,6 +454,8 @@ private:
// when source id changed, for example, the edge reconnect,
// invoke the on_source_id_changed() to let all clients know.
int _source_id;
// previous source id.
int _pre_source_id;
// deep copy of client request.
SrsRequest* _req;
// to delivery stream to clients.
@ -501,6 +506,9 @@ private:
*/
// TODO: FIXME: to support reload atc.
bool atc;
// last die time, when all consumers quit and no publisher,
// we will remove the source when source die.
int64_t die_at;
private:
SrsSharedPtrMessage* cache_metadata;
// the cached video sequence header.
@ -513,6 +521,8 @@ public:
public:
virtual void dispose();
virtual int cycle();
// remove source when expired.
virtual bool expired();
// initialize, get and setter.
public:
/**
@ -543,6 +553,7 @@ public:
virtual int on_source_id_changed(int id);
// get current source id.
virtual int source_id();
virtual int pre_source_id();
// logic data methods
public:
virtual bool can_publish(bool is_edge);