mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Remove dead code: memory watch
This commit is contained in:
parent
c6cb0fb21f
commit
1f621a6db3
11 changed files with 1 additions and 182 deletions
|
@ -111,12 +111,6 @@ else
|
||||||
srs_undefine_macro "SRS_HTTPS" $SRS_AUTO_HEADERS_H
|
srs_undefine_macro "SRS_HTTPS" $SRS_AUTO_HEADERS_H
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $SRS_MEM_WATCH = YES ]; then
|
|
||||||
srs_define_macro "SRS_MEM_WATCH" $SRS_AUTO_HEADERS_H
|
|
||||||
else
|
|
||||||
srs_undefine_macro "SRS_MEM_WATCH" $SRS_AUTO_HEADERS_H
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $SRS_UTEST = YES ]; then
|
if [ $SRS_UTEST = YES ]; then
|
||||||
srs_define_macro "SRS_UTEST" $SRS_AUTO_HEADERS_H
|
srs_define_macro "SRS_UTEST" $SRS_AUTO_HEADERS_H
|
||||||
else
|
else
|
||||||
|
|
|
@ -76,9 +76,6 @@ SRS_LOG_TRACE=YES
|
||||||
# donot compile ssl, use system ssl(-lssl) if required.
|
# donot compile ssl, use system ssl(-lssl) if required.
|
||||||
# TODO: Use pkg-config to get the openssl path.
|
# TODO: Use pkg-config to get the openssl path.
|
||||||
SRS_USE_SYS_SSL=NO
|
SRS_USE_SYS_SSL=NO
|
||||||
# enable memory watch, detect memory leak,
|
|
||||||
# similar to gmc, should disable in release version for hurts performance.
|
|
||||||
SRS_MEM_WATCH=NO
|
|
||||||
# export the srs-librtmp to specified project, NO to disable it.
|
# export the srs-librtmp to specified project, NO to disable it.
|
||||||
SRS_EXPORT_LIBRTMP_PROJECT=NO
|
SRS_EXPORT_LIBRTMP_PROJECT=NO
|
||||||
# export the srs-librtmp to a single .h and .c, NO to disable it.
|
# export the srs-librtmp to a single .h and .c, NO to disable it.
|
||||||
|
@ -376,7 +373,6 @@ function parse_user_option() {
|
||||||
--disable-all) SRS_DISABLE_ALL=YES ;;
|
--disable-all) SRS_DISABLE_ALL=YES ;;
|
||||||
--pure-rtmp) SRS_PURE_RTMP=YES ;;
|
--pure-rtmp) SRS_PURE_RTMP=YES ;;
|
||||||
--full) SRS_ENABLE_ALL=YES ;;
|
--full) SRS_ENABLE_ALL=YES ;;
|
||||||
--memory-watch) SRS_MEM_WATCH=YES ;;
|
|
||||||
--export-librtmp-project) SRS_EXPORT_LIBRTMP_PROJECT=${value} ;;
|
--export-librtmp-project) SRS_EXPORT_LIBRTMP_PROJECT=${value} ;;
|
||||||
--export-librtmp-single) SRS_EXPORT_LIBRTMP_SINGLE=${value} ;;
|
--export-librtmp-single) SRS_EXPORT_LIBRTMP_SINGLE=${value} ;;
|
||||||
--with-nginx) SRS_NGINX=YES ;;
|
--with-nginx) SRS_NGINX=YES ;;
|
||||||
|
|
2
trunk/configure
vendored
2
trunk/configure
vendored
|
@ -204,7 +204,7 @@ MODULE_ID="CORE"
|
||||||
MODULE_DEPENDS=()
|
MODULE_DEPENDS=()
|
||||||
ModuleLibIncs=(${SRS_OBJS_DIR})
|
ModuleLibIncs=(${SRS_OBJS_DIR})
|
||||||
MODULE_FILES=("srs_core" "srs_core_version4" "srs_core_autofree" "srs_core_performance"
|
MODULE_FILES=("srs_core" "srs_core_version4" "srs_core_autofree" "srs_core_performance"
|
||||||
"srs_core_mem_watch" "srs_core_time")
|
"srs_core_time")
|
||||||
CORE_INCS="src/core"; MODULE_DIR=${CORE_INCS} . auto/modules.sh
|
CORE_INCS="src/core"; MODULE_DIR=${CORE_INCS} . auto/modules.sh
|
||||||
CORE_OBJS="${MODULE_OBJS[@]}"
|
CORE_OBJS="${MODULE_OBJS[@]}"
|
||||||
#
|
#
|
||||||
|
|
|
@ -9,8 +9,6 @@ file
|
||||||
../../src/core/srs_core.cpp,
|
../../src/core/srs_core.cpp,
|
||||||
../../src/core/srs_core_autofree.hpp,
|
../../src/core/srs_core_autofree.hpp,
|
||||||
../../src/core/srs_core_autofree.cpp,
|
../../src/core/srs_core_autofree.cpp,
|
||||||
../../src/core/srs_core_mem_watch.hpp,
|
|
||||||
../../src/core/srs_core_mem_watch.cpp,
|
|
||||||
../../src/core/srs_core_performance.hpp,
|
../../src/core/srs_core_performance.hpp,
|
||||||
../../src/core/srs_core_performance.cpp,
|
../../src/core/srs_core_performance.cpp,
|
||||||
kernel readonly separator,
|
kernel readonly separator,
|
||||||
|
|
|
@ -101,7 +101,6 @@
|
||||||
<ClInclude Include="..\..\src\app\srs_app_utility.hpp" />
|
<ClInclude Include="..\..\src\app\srs_app_utility.hpp" />
|
||||||
<ClInclude Include="..\..\src\core\srs_core.hpp" />
|
<ClInclude Include="..\..\src\core\srs_core.hpp" />
|
||||||
<ClInclude Include="..\..\src\core\srs_core_autofree.hpp" />
|
<ClInclude Include="..\..\src\core\srs_core_autofree.hpp" />
|
||||||
<ClInclude Include="..\..\src\core\srs_core_mem_watch.hpp" />
|
|
||||||
<ClInclude Include="..\..\src\core\srs_core_performance.hpp" />
|
<ClInclude Include="..\..\src\core\srs_core_performance.hpp" />
|
||||||
<ClInclude Include="..\..\src\kernel\srs_kernel_aac.hpp" />
|
<ClInclude Include="..\..\src\kernel\srs_kernel_aac.hpp" />
|
||||||
<ClInclude Include="..\..\src\kernel\srs_kernel_avc.hpp" />
|
<ClInclude Include="..\..\src\kernel\srs_kernel_avc.hpp" />
|
||||||
|
@ -167,7 +166,6 @@
|
||||||
<ClCompile Include="..\..\src\app\srs_app_utility.cpp" />
|
<ClCompile Include="..\..\src\app\srs_app_utility.cpp" />
|
||||||
<ClCompile Include="..\..\src\core\srs_core.cpp" />
|
<ClCompile Include="..\..\src\core\srs_core.cpp" />
|
||||||
<ClCompile Include="..\..\src\core\srs_core_autofree.cpp" />
|
<ClCompile Include="..\..\src\core\srs_core_autofree.cpp" />
|
||||||
<ClCompile Include="..\..\src\core\srs_core_mem_watch.cpp" />
|
|
||||||
<ClCompile Include="..\..\src\core\srs_core_performance.cpp" />
|
<ClCompile Include="..\..\src\core\srs_core_performance.cpp" />
|
||||||
<ClCompile Include="..\..\src\kernel\srs_kernel_aac.cpp" />
|
<ClCompile Include="..\..\src\kernel\srs_kernel_aac.cpp" />
|
||||||
<ClCompile Include="..\..\src\kernel\srs_kernel_avc.cpp" />
|
<ClCompile Include="..\..\src\kernel\srs_kernel_avc.cpp" />
|
||||||
|
|
|
@ -81,7 +81,6 @@
|
||||||
3C4AB9331B8C9148006627D3 /* srs_app_ng_exec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C4AB9311B8C9148006627D3 /* srs_app_ng_exec.cpp */; };
|
3C4AB9331B8C9148006627D3 /* srs_app_ng_exec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C4AB9311B8C9148006627D3 /* srs_app_ng_exec.cpp */; };
|
||||||
3C4D184C1E73F133008806F7 /* srs_app_fragment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C4D184A1E73F133008806F7 /* srs_app_fragment.cpp */; };
|
3C4D184C1E73F133008806F7 /* srs_app_fragment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C4D184A1E73F133008806F7 /* srs_app_fragment.cpp */; };
|
||||||
3C4F97121B8B466D00FF0E46 /* srs_app_process.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C4F97101B8B466D00FF0E46 /* srs_app_process.cpp */; };
|
3C4F97121B8B466D00FF0E46 /* srs_app_process.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C4F97101B8B466D00FF0E46 /* srs_app_process.cpp */; };
|
||||||
3C5265B41B241BF0009CA186 /* srs_core_mem_watch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C5265B21B241BF0009CA186 /* srs_core_mem_watch.cpp */; };
|
|
||||||
3C663F0F1AB0155100286D8B /* srs_aac_raw_publish.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F021AB0155100286D8B /* srs_aac_raw_publish.c */; };
|
3C663F0F1AB0155100286D8B /* srs_aac_raw_publish.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F021AB0155100286D8B /* srs_aac_raw_publish.c */; };
|
||||||
3C663F101AB0155100286D8B /* srs_audio_raw_publish.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F031AB0155100286D8B /* srs_audio_raw_publish.c */; };
|
3C663F101AB0155100286D8B /* srs_audio_raw_publish.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F031AB0155100286D8B /* srs_audio_raw_publish.c */; };
|
||||||
3C6F2D751E8653BF003D0805 /* srs_main_mp4_parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C6F2D741E8653BF003D0805 /* srs_main_mp4_parser.cpp */; };
|
3C6F2D751E8653BF003D0805 /* srs_main_mp4_parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C6F2D741E8653BF003D0805 /* srs_main_mp4_parser.cpp */; };
|
||||||
|
@ -343,7 +342,6 @@
|
||||||
3C4D184B1E73F133008806F7 /* srs_app_fragment.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_fragment.hpp; path = ../../../src/app/srs_app_fragment.hpp; sourceTree = "<group>"; };
|
3C4D184B1E73F133008806F7 /* srs_app_fragment.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_fragment.hpp; path = ../../../src/app/srs_app_fragment.hpp; sourceTree = "<group>"; };
|
||||||
3C4F97101B8B466D00FF0E46 /* srs_app_process.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_app_process.cpp; path = ../../../src/app/srs_app_process.cpp; sourceTree = "<group>"; };
|
3C4F97101B8B466D00FF0E46 /* srs_app_process.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_app_process.cpp; path = ../../../src/app/srs_app_process.cpp; sourceTree = "<group>"; };
|
||||||
3C4F97111B8B466D00FF0E46 /* srs_app_process.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_process.hpp; path = ../../../src/app/srs_app_process.hpp; sourceTree = "<group>"; };
|
3C4F97111B8B466D00FF0E46 /* srs_app_process.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_process.hpp; path = ../../../src/app/srs_app_process.hpp; sourceTree = "<group>"; };
|
||||||
3C5265B21B241BF0009CA186 /* srs_core_mem_watch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_core_mem_watch.cpp; path = ../../../src/core/srs_core_mem_watch.cpp; sourceTree = "<group>"; };
|
|
||||||
3C6673CF1DF7B93200A6DF57 /* readme.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = readme.txt; path = ../../../modules/readme.txt; sourceTree = "<group>"; };
|
3C6673CF1DF7B93200A6DF57 /* readme.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = readme.txt; path = ../../../modules/readme.txt; sourceTree = "<group>"; };
|
||||||
3C6673D11DF7B95E00A6DF57 /* config */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = config; path = "../../../modules/hls-ingester/config"; sourceTree = "<group>"; };
|
3C6673D11DF7B95E00A6DF57 /* config */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = config; path = "../../../modules/hls-ingester/config"; sourceTree = "<group>"; };
|
||||||
3C6F2D731E86536B003D0805 /* config */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = config; path = "../../../modules/mp4-parser/config"; sourceTree = "<group>"; };
|
3C6F2D731E86536B003D0805 /* config */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = config; path = "../../../modules/mp4-parser/config"; sourceTree = "<group>"; };
|
||||||
|
@ -473,8 +471,6 @@
|
||||||
children = (
|
children = (
|
||||||
3C1231F01AAE652C00CE8F6C /* srs_core_autofree.cpp */,
|
3C1231F01AAE652C00CE8F6C /* srs_core_autofree.cpp */,
|
||||||
3C1231F11AAE652C00CE8F6C /* srs_core_autofree.hpp */,
|
3C1231F11AAE652C00CE8F6C /* srs_core_autofree.hpp */,
|
||||||
3C5265B21B241BF0009CA186 /* srs_core_mem_watch.cpp */,
|
|
||||||
3C5265B31B241BF0009CA186 /* srs_core_mem_watch.hpp */,
|
|
||||||
3C1231F21AAE652C00CE8F6C /* srs_core_performance.cpp */,
|
3C1231F21AAE652C00CE8F6C /* srs_core_performance.cpp */,
|
||||||
3C1231F31AAE652C00CE8F6C /* srs_core_performance.hpp */,
|
3C1231F31AAE652C00CE8F6C /* srs_core_performance.hpp */,
|
||||||
3C1231F41AAE652D00CE8F6C /* srs_core.cpp */,
|
3C1231F41AAE652D00CE8F6C /* srs_core.cpp */,
|
||||||
|
@ -984,7 +980,6 @@
|
||||||
3C663F151AB0155100286D8B /* srs_h264_raw_publish.c in Sources */,
|
3C663F151AB0155100286D8B /* srs_h264_raw_publish.c in Sources */,
|
||||||
3C1231F61AAE652D00CE8F6C /* srs_core_autofree.cpp in Sources */,
|
3C1231F61AAE652D00CE8F6C /* srs_core_autofree.cpp in Sources */,
|
||||||
8C0652B12035B5BA000B0661 /* srs_app_coworkers.cpp in Sources */,
|
8C0652B12035B5BA000B0661 /* srs_app_coworkers.cpp in Sources */,
|
||||||
3C5265B41B241BF0009CA186 /* srs_core_mem_watch.cpp in Sources */,
|
|
||||||
3C1EE6D71AB1367D00576EE9 /* README.md in Sources */,
|
3C1EE6D71AB1367D00576EE9 /* README.md in Sources */,
|
||||||
3C82802C1BAFF8CC004A1794 /* srs_kafka_stack.cpp in Sources */,
|
3C82802C1BAFF8CC004A1794 /* srs_kafka_stack.cpp in Sources */,
|
||||||
3C1232411AAE81A400CE8F6C /* srs_raw_avc.cpp in Sources */,
|
3C1232411AAE81A400CE8F6C /* srs_raw_avc.cpp in Sources */,
|
||||||
|
|
|
@ -50,7 +50,6 @@ using namespace std;
|
||||||
#include <srs_app_rtsp.hpp>
|
#include <srs_app_rtsp.hpp>
|
||||||
#include <srs_app_statistic.hpp>
|
#include <srs_app_statistic.hpp>
|
||||||
#include <srs_app_caster_flv.hpp>
|
#include <srs_app_caster_flv.hpp>
|
||||||
#include <srs_core_mem_watch.hpp>
|
|
||||||
#include <srs_kernel_consts.hpp>
|
#include <srs_kernel_consts.hpp>
|
||||||
#include <srs_app_coworkers.hpp>
|
#include <srs_app_coworkers.hpp>
|
||||||
#include <srs_app_gb28181.hpp>
|
#include <srs_app_gb28181.hpp>
|
||||||
|
@ -745,10 +744,6 @@ void SrsServer::dispose()
|
||||||
_srs_sources->dispose();
|
_srs_sources->dispose();
|
||||||
|
|
||||||
// @remark don't dispose all connections, for too slow.
|
// @remark don't dispose all connections, for too slow.
|
||||||
|
|
||||||
#ifdef SRS_MEM_WATCH
|
|
||||||
srs_memory_report();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SrsServer::gracefully_dispose()
|
void SrsServer::gracefully_dispose()
|
||||||
|
@ -790,10 +785,6 @@ void SrsServer::gracefully_dispose()
|
||||||
_srs_sources->dispose();
|
_srs_sources->dispose();
|
||||||
srs_trace("source disposed");
|
srs_trace("source disposed");
|
||||||
|
|
||||||
#ifdef SRS_MEM_WATCH
|
|
||||||
srs_memory_report();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
srs_usleep(_srs_config->get_grace_final_wait());
|
srs_usleep(_srs_config->get_grace_final_wait());
|
||||||
srs_trace("final wait for %dms", srsu2msi(_srs_config->get_grace_final_wait()));
|
srs_trace("final wait for %dms", srsu2msi(_srs_config->get_grace_final_wait()));
|
||||||
}
|
}
|
||||||
|
@ -1169,10 +1160,6 @@ void SrsServer::on_signal(int signo)
|
||||||
#ifdef SRS_GPERF_MC
|
#ifdef SRS_GPERF_MC
|
||||||
srs_trace("gmc is on, main cycle will terminate normally, signo=%d", signo);
|
srs_trace("gmc is on, main cycle will terminate normally, signo=%d", signo);
|
||||||
signal_gmc_stop = true;
|
signal_gmc_stop = true;
|
||||||
#else
|
|
||||||
#ifdef SRS_MEM_WATCH
|
|
||||||
srs_memory_report();
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,86 +0,0 @@
|
||||||
/**
|
|
||||||
* The MIT License (MIT)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013-2020 Winlin
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
* this software and associated documentation files (the "Software"), to deal in
|
|
||||||
* the Software without restriction, including without limitation the rights to
|
|
||||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
* subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <srs_core_mem_watch.hpp>
|
|
||||||
|
|
||||||
#ifdef SRS_MEM_WATCH
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <stdio.h>
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
struct SrsMemoryObject
|
|
||||||
{
|
|
||||||
void* ptr;
|
|
||||||
std::string category;
|
|
||||||
int size;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::map<void*, SrsMemoryObject*> _srs_ptrs;
|
|
||||||
|
|
||||||
void srs_memory_watch(void* ptr, string category, int size)
|
|
||||||
{
|
|
||||||
SrsMemoryObject* obj = NULL;
|
|
||||||
|
|
||||||
std::map<void*, SrsMemoryObject*>::iterator it;
|
|
||||||
if ((it = _srs_ptrs.find(ptr)) != _srs_ptrs.end()) {
|
|
||||||
obj = it->second;
|
|
||||||
} else {
|
|
||||||
obj = new SrsMemoryObject();
|
|
||||||
_srs_ptrs[ptr] = obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
obj->ptr = ptr;
|
|
||||||
obj->category = category;
|
|
||||||
obj->size = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
void srs_memory_unwatch(void* ptr)
|
|
||||||
{
|
|
||||||
std::map<void*, SrsMemoryObject*>::iterator it;
|
|
||||||
if ((it = _srs_ptrs.find(ptr)) != _srs_ptrs.end()) {
|
|
||||||
SrsMemoryObject* obj = it->second;
|
|
||||||
srs_freep(obj);
|
|
||||||
|
|
||||||
_srs_ptrs.erase(it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void srs_memory_report()
|
|
||||||
{
|
|
||||||
printf("srs memory watch leak report:\n");
|
|
||||||
|
|
||||||
int total = 0;
|
|
||||||
std::map<void*, SrsMemoryObject*>::iterator it;
|
|
||||||
for (it = _srs_ptrs.begin(); it != _srs_ptrs.end(); ++it) {
|
|
||||||
SrsMemoryObject* obj = it->second;
|
|
||||||
printf(" %s: %#" PRIx64 ", %dB\n", obj->category.c_str(), (int64_t)obj->ptr, obj->size);
|
|
||||||
total += obj->size;
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
/**
|
|
||||||
* The MIT License (MIT)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013-2020 Winlin
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
* this software and associated documentation files (the "Software"), to deal in
|
|
||||||
* the Software without restriction, including without limitation the rights to
|
|
||||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
* subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SRS_CORE_MEM_WATCH_HPP
|
|
||||||
#define SRS_CORE_MEM_WATCH_HPP
|
|
||||||
|
|
||||||
#include <srs_core.hpp>
|
|
||||||
|
|
||||||
#ifdef SRS_MEM_WATCH
|
|
||||||
|
|
||||||
#warning "MemoryWatch is deprecated."
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
// Watch the specified memory.
|
|
||||||
extern void srs_memory_watch(void* ptr, std::string category, int size);
|
|
||||||
|
|
||||||
// Unwatch the specified memory.
|
|
||||||
extern void srs_memory_unwatch(void* ptr);
|
|
||||||
|
|
||||||
// Report the memory watch.
|
|
||||||
extern void srs_memory_report();
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ using namespace std;
|
||||||
#include <srs_kernel_file.hpp>
|
#include <srs_kernel_file.hpp>
|
||||||
#include <srs_kernel_codec.hpp>
|
#include <srs_kernel_codec.hpp>
|
||||||
#include <srs_kernel_utility.hpp>
|
#include <srs_kernel_utility.hpp>
|
||||||
#include <srs_core_mem_watch.hpp>
|
|
||||||
#include <srs_core_autofree.hpp>
|
#include <srs_core_autofree.hpp>
|
||||||
|
|
||||||
SrsMessageHeader::SrsMessageHeader()
|
SrsMessageHeader::SrsMessageHeader()
|
||||||
|
@ -161,9 +160,6 @@ SrsCommonMessage::SrsCommonMessage()
|
||||||
|
|
||||||
SrsCommonMessage::~SrsCommonMessage()
|
SrsCommonMessage::~SrsCommonMessage()
|
||||||
{
|
{
|
||||||
#ifdef SRS_MEM_WATCH
|
|
||||||
srs_memory_unwatch(payload);
|
|
||||||
#endif
|
|
||||||
srs_freepa(payload);
|
srs_freepa(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,10 +169,6 @@ void SrsCommonMessage::create_payload(int size)
|
||||||
|
|
||||||
payload = new char[size];
|
payload = new char[size];
|
||||||
srs_verbose("create payload for RTMP message. size=%d", size);
|
srs_verbose("create payload for RTMP message. size=%d", size);
|
||||||
|
|
||||||
#ifdef SRS_MEM_WATCH
|
|
||||||
srs_memory_watch(payload, "RTMP.msg.payload", size);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsCommonMessage::create(SrsMessageHeader* pheader, char* body, int size)
|
srs_error_t SrsCommonMessage::create(SrsMessageHeader* pheader, char* body, int size)
|
||||||
|
@ -211,9 +203,6 @@ SrsSharedPtrMessage::SrsSharedPtrPayload::SrsSharedPtrPayload()
|
||||||
|
|
||||||
SrsSharedPtrMessage::SrsSharedPtrPayload::~SrsSharedPtrPayload()
|
SrsSharedPtrMessage::SrsSharedPtrPayload::~SrsSharedPtrPayload()
|
||||||
{
|
{
|
||||||
#ifdef SRS_MEM_WATCH
|
|
||||||
srs_memory_unwatch(payload);
|
|
||||||
#endif
|
|
||||||
srs_freepa(payload);
|
srs_freepa(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -355,11 +355,6 @@ void show_macro_features()
|
||||||
srs_trace("system default latency(ms): mw(0-%d) + mr(0-%d) + play-queue(0-%d)",
|
srs_trace("system default latency(ms): mw(0-%d) + mr(0-%d) + play-queue(0-%d)",
|
||||||
srsu2msi(SRS_PERF_MW_SLEEP), possible_mr_latency, srsu2msi(SRS_PERF_PLAY_QUEUE));
|
srsu2msi(SRS_PERF_MW_SLEEP), possible_mr_latency, srsu2msi(SRS_PERF_PLAY_QUEUE));
|
||||||
|
|
||||||
#ifdef SRS_MEM_WATCH
|
|
||||||
#warning "srs memory watcher will hurts performance. user should kill by SIGTERM or init.d script."
|
|
||||||
srs_warn("srs memory watcher will hurts performance. user should kill by SIGTERM or init.d script.");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if VERSION_MAJOR > VERSION_STABLE
|
#if VERSION_MAJOR > VERSION_STABLE
|
||||||
#warning "Current branch is not stable."
|
#warning "Current branch is not stable."
|
||||||
srs_warn("%s/%s is not stable", RTMP_SIG_SRS_KEY, RTMP_SIG_SRS_VERSION);
|
srs_warn("%s/%s is not stable", RTMP_SIG_SRS_KEY, RTMP_SIG_SRS_VERSION);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue