[FFmpeg-devel] mem leak on windows xp sp2

David Starkweather starkdg
Tue Nov 24 19:47:22 CET 2009


I am pretty certain I have found a memory leak that occurs on windows xp
sp2.  I have included a test file that I have run on windows xp, vista as
well as linux.  The only one in which there is a memory leak is xp.  So far,
I have found this using audio files (.mp3 or .wav).  

 

Compile: gcc -otestffmpeg testffmpeg.c -I .  -L   -lavformat -lavcodec
-lswscale

 

Run: testffmpeg <pathandfilenameheretoaudiofile>

 

Get the file here: http://ffmpeg.pastebin.com/m5940ac6d

 

There are two pauses in the test program allowing to track the number of
bytes consumed by the process before and after the function call.  Note that
the buffer in which the signal is put is allocated before and free'd after
these two pauses, so the extra memory used is not from this buffer.

 

The number of private bytes jumps from 143,257,600 to 157110272

The number of virtual bytes jumps from 152, 702, 976 to 168, 435, 712

 

When reading in many files in a loop, the excess memory accumulates rather
quickly.

 

This appears to be the offending stack trace from umdh utility:

 

35955144 ( 35955144 -      0)   8727 allocs           BackTrace234

+    8727 (   8727 -      0)            BackTrace234   allocations

 

            ntdll!RtlDebugAllocateHeap+000000E1

            ntdll!RtlAllocateHeapSlowly+00000044

            ntdll!RtlAllocateHeap+00000E64

            msvcrt!_heap_alloc+000000E0

            msvcrt!_nh_malloc+00000013

            msvcrt!malloc+00000027

            avutil-49!av_malloc+00000025 

 

I hope I have provided enough information here.  I am more than happy to
attempt a patch, if someone has any suggestions as to what the cause could
be.  If not, does anyone have a workaround?

 

Thanks,

Dgs.




More information about the ffmpeg-devel mailing list