mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine code, support configure to enable --memory-watch
This commit is contained in:
parent
0d6a574216
commit
0d66e92ab5
8 changed files with 22 additions and 17 deletions
|
@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include <srs_core_mem_watch.hpp>
|
||||
|
||||
#ifdef SRS_MEM_WATCH
|
||||
#ifdef SRS_AUTO_MEM_WATCH
|
||||
|
||||
#include <map>
|
||||
#include <stdio.h>
|
||||
|
@ -68,7 +68,7 @@ void srs_memory_unwatch(void* ptr)
|
|||
|
||||
void srs_memory_report()
|
||||
{
|
||||
printf("srs memory leak report:\n");
|
||||
printf("srs memory watch leak report:\n");
|
||||
|
||||
int total = 0;
|
||||
std::map<void*, SrsMemoryObject*>::iterator it;
|
||||
|
@ -79,6 +79,7 @@ void srs_memory_report()
|
|||
}
|
||||
|
||||
printf("%d objects leak %dKB.\n", (int)_srs_ptrs.size(), total / 1024);
|
||||
printf("@remark use script to cleanup for memory watch: ./etc/init.d/srs stop\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include <srs_core.hpp>
|
||||
|
||||
#ifdef SRS_MEM_WATCH
|
||||
#ifdef SRS_AUTO_MEM_WATCH
|
||||
|
||||
#include <string>
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
* to force the server to send smaller tcp packet.
|
||||
* @see https://github.com/simple-rtmp-server/srs/issues/320
|
||||
* @remark undef it to auto calc it by merged write sleep ms.
|
||||
* @remark only apply it when SRS_PERF_MW_SO_RCVBUF is defined.
|
||||
* @remark only apply it when SRS_PERF_MW_SO_SNDBUF is defined.
|
||||
*/
|
||||
#ifdef SRS_PERF_MW_SO_SNDBUF
|
||||
//#define SRS_PERF_SO_SNDBUF_SIZE 1024
|
||||
|
@ -188,12 +188,5 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#undef SRS_PERF_FAST_FLV_ENCODER
|
||||
#define SRS_PERF_FAST_FLV_ENCODER
|
||||
|
||||
/**
|
||||
* whether enable the special memory watcher.
|
||||
* which used for memory leak debug and hurts performance.
|
||||
*/
|
||||
#define SRS_MEM_WATCH
|
||||
#undef SRS_MEM_WATCH
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue