High RAM Usage; Ram Usage increase all the time
Describe the bug Hello i have a clear install srs from stock. After 6H runtime without Clients and Streams i have a ram Usage from21% from 2GB. On Older test i see an idle ram usage of 23MB not 420MB like me
If i kill the prozess with pkill srs it slowly increase ram usage from 2,1%. After 1 Minute i have 3.2% in idle
Version SRS/7.0.20
To Reproduce Steps to reproduce the behavior:
- I Start the server with: ./objs/srs -c conf/srs.conf
- Whaitt a time and the ram usage increase without streams and clients.
My Config looks like:
listen 1935;
max_connections 1000;
#srs_log_tank file;
#srs_log_file ./objs/srs.log;
daemon on;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
hls {
enabled on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc off;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp off;
}
play{
gop_cache_max_frames 2500;
}
}
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.
Hello, today i have push a test stream to osr with ffmpeg and 1 client.. now i have no clients an no users but osrs use now 50,9% of ram form 2GB
There might be a memory leak with HLS components.Try disable that.
hy,
i habe changed
hls { enabled off;
to off and restart it, no changes in ram usage
Hy I have test it from 5.0 over 6.0 to developer releases all the same
If I refresh the summary/dashboard often I can see a ram usage increase faster than I do nothing.
Maybe some log files in cache or other thinks in cache?
Any ideas. I don't can be the first who find out it :)
flv is the same
3 month later bug fix?
i use srs 5.0.213, the same issue ,two instance use memory 12g and 6g. i check conf again, found different , inotify_auto_reload not conf at the nornaml instance, its maybe . my srs conf:
listen 19450; max_connections 65535; daemon on; pid ./pid/srs_origin_1.pid;
srs_log_file ./logs/srs_origin_1.log; srs_log_tank file; srs_log_level info; inotify_auto_reload on;
http_api { enabled on; listen 9881; } http_server { enabled on; listen 9281; dir ./objs/nginx/html; } vhost defaultVhost { cluster { mode local; origin_cluster on; coworkers 10.32.37.254:9882 10.33.36.10:9881 10.33.36.10:9882; }
publish {
normal_timeout 5000;
}
http_hooks {
enabled on;
on_dvr http://127.0.0.1:8089/api/v1/live;
}
dvr {
enabled on;
dvr_apply all;
dvr_plan session;
dvr_path /home/work/dvr/[app]/[stream].[timestamp].mp4;
dvr_duration 360000;
dvr_wait_keyframe on;
time_jitter full;
}
}
This issue has been resolved in the latest version of SRS 6 and SRS 7.
Root Cause: Address Sanitizer (ASAN) was enabled by default in version 7.0.20, which caused significant memory overhead and apparent memory growth. ASAN is a debugging tool that intentionally holds onto freed memory to detect use-after-free bugs, which explains why RAM usage kept increasing even when idle.
Solution: Sanitizer has been disabled by default in newer versions. Please upgrade to the latest SRS version to resolve this issue.
If you're unable to upgrade immediately, you can rebuild SRS from source without the sanitizer flag as a workaround.
The expected idle RAM usage of ~23MB (without sanitizer) is normal for production builds.