[FFmpeg-devel] MPADecodeContext on stack

Jason Garrett-Glaser darkshikari
Thu Jan 22 11:59:00 CET 2009

On Thu, Jan 22, 2009 at 2:55 AM, Marc Mason <mpeg.blue at free.fr> wrote:
> M?ns Rullg?rd wrote:
>> Here's a list of stack offenders on ARM:
>> 6553600 encode_frame                   nellymoserenc.c:339
>>  262144 ff_mjpeg_decode_sos            mjpegdec.c:886
>>  105472 AC3_encode_frame               ac3enc.c:1147
>> ...
>> Some of these include stack space used by inlined functions called
>> from those named.
>> These are all the functions using more than 4k of stack space.
> Could you explain how you generated that list ?

Mans posted the script on #ffmpeg-devel on Freenode for me--here's his
modified version for x86_64:

objdump -d ffmpeg_g | perl -ne
's/\s*([[:xdigit:]]+):.*sub\s+\$0x([[:xdigit:]]+),%rsp/sprintf "$1
%d", hex $2/e and print' | sort -nr -k2 | while read addr size; do
f=$(addr2line -e ffmpeg_g -s -f ${addr%:}); printf '%7d %-30s %s\n'
$size $f; done

Replace "rsp" with "esp" for x86_32.

Note this *does not work on Windows* because all functions larger than
4K stack size will call __chkstk instead, and so it can't easily
detect the stack size.

Dark Shikari

More information about the ffmpeg-devel mailing list