Opened 9 years ago

Closed 9 years ago

#2534 closed defect (needs_more_info)

maybe memory leak of av_read_frame/av_free_packet.

Reported by: yan Owned by:
Priority: normal Component: avformat
Version: 1.2 Keywords: leak
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


i use vertion 1.2 and compile for android (armv7a without neon), following by the guide of "how to compile ffmpeg for android" (

then i get the "*.so"s succesful.

here is my testing code:

AVPacket pkt;
int readRet = 0;

readRet = av_read_frame(s,&avpkt);
if(readRet < 0)

printf("read EOF\n");



then i check the status of memory usage by using "cat /proc/meminfo"

that after about 20secs from the testing code running.

the "free memory" line in the cat result become less and less.

almost 1MiB eating by the testing code per second.

after the testing code exit by reach the EOF. the eat memory not released !!!!!

the media file is a AVI content file, with H264 1080P60FPS video,and AAC 192K audio stream.

I tried stable version 1.2, 0.11.

Change History (4)

in reply to:  description comment:1 by Carl Eugen Hoyos, 9 years ago

Cc: arm-eabi-gcc removed
Keywords: leak added; memory leaks of avformat removed
Priority: importantnormal
Type: enhancementdefect

Replying to yan:

the "free memory" line in the cat result become less and less.

This is generally not an indication for a memory leak, valgrind output or equivalent is needed for reports about memleaks.
Does valgrind show any leaks?

And please test current git head before reporting bugs.

comment:2 by Alexis Farmer, 9 years ago

I also see an "apparent" memory leak when decoding video on android. I've narrowed it down to the same decoding loop as Yan. It eats up all the memory on the devices i've been testing until they crash. Its years since I've used valgrind, this is such a big leak it should be easy to find without using anything like valgrind?????

Its strange because other people should see this problem too.

Yan, did you patch the ffmpeg source at all or just build it straight from the repository?

I'd like to help out on this one.

in reply to:  2 comment:3 by Carl Eugen Hoyos, 9 years ago

Replying to destroyboy:

I also see an "apparent" memory leak when decoding video on android.

Did you test current git head?

Please provide valgrind output.

comment:4 by Carl Eugen Hoyos, 9 years ago

Resolution: needs_more_info
Status: newclosed

Please reopen this ticket if you can provide valgrind output or complete source code that allows to reproduce the problem.

Note: See TracTickets for help on using tickets.