winlin

refine the memory watcher.

... ... @@ -961,6 +961,12 @@ void SrsSource::dispose()
hls->dispose();
#endif
// cleaup the cached packets.
srs_freep(cache_metadata);
srs_freep(cache_sh_video);
srs_freep(cache_sh_audio);
// cleanup the gop cache.
gop_cache->dispose();
}
... ...
... ... @@ -74,7 +74,7 @@ void srs_memory_report()
std::map<void*, SrsMemoryObject*>::iterator it;
for (it = _srs_ptrs.begin(); it != _srs_ptrs.end(); ++it) {
SrsMemoryObject* obj = it->second;
printf(" %s: %#"PRIx64", %dKB\n", obj->category.c_str(), (int64_t)obj->ptr, obj->size / 1000);
printf(" %s: %#"PRIx64", %dB\n", obj->category.c_str(), (int64_t)obj->ptr, obj->size);
total += obj->size;
}
... ...
... ... @@ -192,8 +192,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* whether enable the special memory watcher.
* which used for memory leak debug and hurts performance.
*/
#undef SRS_MEM_WATCH
#define SRS_MEM_WATCH
#undef SRS_MEM_WATCH
#endif
... ...
... ... @@ -211,6 +211,11 @@ void check_macro_features()
#warning "current branch is not stable, please use stable branch instead."
srs_warn("SRS %s is not stable, please use stable branch %s instead", RTMP_SIG_SRS_VERSION, VERSION_STABLE_BRANCH);
#endif
#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 defined(SRS_AUTO_STREAM_CASTER)
#warning "stream caster is experiment feature."
... ...