[rtmpdump] spike in memory usage

Leontie Eugen e_leontie at yahoo.com
Wed Jan 4 22:35:18 CET 2012


When using ffmpeg compiled and linked with librtmp to decode a ustream radio, I have experienced some very large memory spikes after a couple of hours of usage. 

Running it in valgrind with the heap profiler shows me that the memory usage is fairly low for a while ( 2-3MB in total) then after a couple of hours ( 4-5 on average ) it spikes to 500-800MB. 
Left running the application is finaly exhausting the memory on the computer after a couple of days and the decoder crashes. All this extra memory is allocated in  RTMPPacket_Alloc, I am not sure if it is a memory leak or a loose packet queue that never stops growing. 
Before I fetch more debugging details, let me ask if this sounds familiar to anyone. 

The command: 
ffmpeg -i "rtmp://flash64.ustream.tv app=ustreamVideo/5210553 playpath=streams/live live=true" -acodec pcm_s16le -f s16le -ac 1 -ar 8000 - > /dev/null

Running it in valgrind: 
valgrind --tool=massif --time-unit=ms --massif-out-file=massif.out.RADIO.%p ~/audionow/work/ffmpeg/bin/ffmpeg -i " rtmp://flash64.ustream.tv app=ustreamVideo/5210553 playpath=streams/live live=true" -acodec pcm_s16le -f s16le  -ac 1 -ar 8000 - > /dev/null


Reported by massif : 
94.10% (986,617,021B) 0x9F7C92: RTMPPacket_Alloc 
| ->94.10% (986,617,021B) 0x9F9C39: RTMP_ReadPacket 
|   ->94.10% (986,617,021B) 0x9FC3A5: RTMP_GetNextMediaPacket
|   | ->94.10% (986,617,021B) 0x9FC4B5: Read_1_Packet 
|   |   ->94.10% (986,617,021B) 0x9FD089: RTMP_Read 
|   |   | ->94.10% (986,617,021B) 0x46C7AA: ffurl_read (avio.c:271)
|   |   |   ->94.10% (986,617,021B) 0x46F6D8: fill_buffer (aviobuf.c:568)
|   |   |   | ->73.83% (774,147,504B) 0x46F833: avio_r8 (aviobuf.c:612)
|   |   |   | | ->73.83% (774,147,504B) 0x4820F9: flv_read_packet (flvdec.c:407)
|   |   |   | | | ->73.83% (774,147,504B) 0x4F1F42: av_read_packet (utils.c:746)
|   |   |   | | |   ->73.83% (774,147,504B) 0x4F3D37: read_frame_internal (utils.c:1216)

Thanks,
Eugen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mplayerhq.hu/pipermail/rtmpdump/attachments/20120104/ec1224e7/attachment.html>


More information about the rtmpdump mailing list