[vlc-devel] Re: Decoder.c memory leak patch
gbazin at altern.org
Thu Jul 29 09:19:14 CEST 2004
On Thursday 29 July 2004 01:45, Mark Moriarty wrote:
> Hi --
> I submitted an e-mail earlier today, not sure if it made it through to
> vlc-devel properly.
> I traced the memory leak I am seeing using the screen: input function (and
> probably the one I saw earlier with my Osprey DirectShow input device on a
> slower CPU).
> What's occuring is that if the raw device input is feeding data faster
> can be processed, memory use balloons. Need to adjust function
> input_DecoderDecode, in \src\input\decoder.c to do a release_Block on
> packets if the FIFO isn't being processed. Otherwise VLC consumes all
> system memory.
Thanks for investigating this.
The patch below is a little less intrusive because it won't drop data blocks
when we have control over the reading pace (eg. transcoding to a file with
However it can't be applied like that either because the p_fifo->i_depth
check is not a reasonable one. Basically you only want to drop data blocks
when you notice that the fifo contains more than a predefined time amount
of data and not number of blocks. A block has an arbitrary size (could be a
few bytes to a few megabytes) so you can't really use that information.
We'll need to use something cleverer, unfortunately when they reach this
level, the data blocks are not necessarily timestamped :(
--- src/input/decoder.c (revision 8308)
+++ src/input/decoder.c (working copy)
@@ -207,8 +207,6 @@
if( p_dec->p_owner->b_own_thread )
- block_FifoPut( p_dec->p_owner->p_fifo, p_block );
if( p_dec->p_owner->p_input->b_out_pace_control )
/* FIXME !!!!! */
@@ -218,6 +216,13 @@
msleep( 1000 );
+ else if( p_dec->p_owner->p_fifo->i_depth > 60 )
+ block_Release( p_block );
+ block_FifoPut( p_dec->p_owner->p_fifo, p_block );
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html
If you are in trouble, please contact <postmaster at videolan.org>
More information about the vlc-devel