[Ffmpeg-devel] Q: Memory leak in av_read_frame in my test app

Zinetz Victor mail
Fri Oct 14 13:35:29 CEST 2005


Hi all

I have trouble in next code (delphi):

[code]
  av_register_all;    
  
  format_context := av_alloc_format_context ();
  try
    assert (av_open_input_file (format_context, pchar (OpenDialog1.FileName), nil, 0, nil) = 0);

    assert (av_find_stream_info (format_context) >= 0);

    while av_read_frame (format_context, @packet) >= 0 do
    begin
      // here i can work with decoded data (convert in rgb and draw it or encode in other format)
    end;
  finally
    av_close_input_file (format_context);

    av_free (format_context);
  end;
end;
[/code]

Every time I execute the following string:

while av_read_frame (format_context, @packet) >= 0 do 

program's memory is grow size . For instance, while reading avi file with 6000 frames of 352x288 pixels, the size of the program can reach up to 22MB

I try too

[code]
  av_init_packet (@packet);
  while av_read_frame (format_context, @packet) >= 0 do
  begin
    av_free_packet (@packet);
  end;
[/code]

- without result

I very need advice (when i try to decode few minutes my video from DV-cam my program grow to 200 MB - =:(

wbr, Victor

p.s. btw, i translate avformat.h/avcodec.h/avio.h & avutil.h in .pas and can now use avformat.dll in delphi projects - this could be a point of interest for someone

p.p.s. sorry for my simple english





More information about the ffmpeg-devel mailing list