<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><div><span style="font-family: 'times new roman', 'new york', times, serif; ">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. </span><br></div><div><font face="'times new roman', 'new york', times, serif">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. </font></div><div><font face="'times new roman', 'new york', times, serif">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  </font><span style="font-family: 'times new roman',
 'new york', times, serif; ">RTMPPacket_Alloc, I am not sure if it is a memory leak or a loose packet queue that never stops growing. </span></div><div><font face="'times new roman', 'new york', times, serif">Before I fetch more debugging details, let me ask if this sounds familiar to anyone. </font></div><div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif">The command: </font></div><div><font face="'times new roman', 'new york', times, serif">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</font></div><div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif">Running it in valgrind: </font></div><div><span style="font-family: 'times new roman', 'new york', times,
 serif; ">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</span><br></div><div><span style="font-family: 'times new roman', 'new york', times, serif; "><br></span></div><div><span style="font-family: 'times new roman', 'new york', times, serif; ">Reported by massif : </span></div><div><span><font face="'times new roman', 'new york', times, serif"><div>94.10% (986,617,021B) 0x9F7C92: RTMPPacket_Alloc </div><div>| ->94.10% (986,617,021B) 0x9F9C39: RTMP_ReadPacket </div><div>|   ->94.10% (986,617,021B) 0x9FC3A5: RTMP_GetNextMediaPacket</div><div>|   | ->94.10% (986,617,021B) 0x9FC4B5: Read_1_Packet </div><div>|   |   ->94.10% (986,617,021B) 0x9FD089: RTMP_Read </div><div>|   |
   | ->94.10% (986,617,021B) 0x46C7AA: ffurl_read (avio.c:271)</div><div>|   |   |   ->94.10% (986,617,021B) 0x46F6D8: fill_buffer (aviobuf.c:568)</div><div>|   |   |   | ->73.83% (774,147,504B) 0x46F833: avio_r8 (aviobuf.c:612)</div><div>|   |   |   | | ->73.83% (774,147,504B) 0x4820F9: flv_read_packet (flvdec.c:407)</div><div>|   |   |   | | | ->73.83% (774,147,504B) 0x4F1F42: av_read_packet (utils.c:746)</div><div>|   |   |   | | |   ->73.83% (774,147,504B) 0x4F3D37: read_frame_internal (utils.c:1216)</div></font></span></div><div><span style="font-family: 'times new roman', 'new york', times, serif; "><br></span></div><div><font face="'times new roman', 'new york', times, serif">Thanks,</font></div><div><font face="'times new roman', 'new york', times, serif">Eugen</font></div></div></div></body></html>