[vlc-devel] commit: Fix memleak (should fix #1081) ( Rémi Duraffort )

Rémi Denis-Courmont rdenis at simphalempin.com
Mon Aug 25 10:24:05 CEST 2008

On Mon, 25 Aug 2008 09:33:21 +0200, Pierre d'Herbemont
<pdherbemont at free.fr> wrote:
>> We cannot have reference counting for blocks, because blocks are  
>> modified
>> downstream. The only thing we have is block_Duplicate, which is of  
>> course
>> slow: malloc + memcpy.
> No. The whole point of refcount is when to destroy it. Not to make  
> sure it won't change if you pass it to a function.

Heck no. Reference counting only works if you have a resource that can be
shared in the first place. For a block of memory the only thing, you will
at the very least want to share the data - otherwise there is nothing to
share, so there is no opportunity for reference counting. On top of that,
there are thread synchronization issues - our block layer is not
thread-safe at all (let alone the block FIFO).

Rémi Denis-Courmont

More information about the vlc-devel mailing list