[matroska-devel] Re: Memory leaks in libmatroska partially fixed

Steve Lhomme steve.lhomme at free.fr
Tue Feb 25 17:16:10 CET 2003


En réponse à Ronald Bultje <rbultje at ronald.bitfreak.net>:

> 
> Hey Steve,
> 
> On Tue, 2003-02-25 at 16:26, Steve Lhomme wrote:
> > Something like a garbage collector ?
> 
> Well, sort of, but much simpler.
> 
> > That could work if we trapped all allocation and check for unfreed
> but
> > referenced element at the end. I'm not sure it would prevent more
> bugs. If
> > someone forget to ref/unref an element for example. While locking
> seems more formal.
> 
> The same goes for memory allocating per se. Forgetting to free causes
> mem leaks. The point is that refcounting actually allows proper
> sharing
> of resources between elements without having the risk of using
> unreferenced (already free()ed) pointers. Having "just" one owner that
> free's the thing is more dangerous and limiting, imo.

Yes, but for the moment the locking system is just to say "don't free me
automatically". It's like a refcount with only 2 values 0 and 1. And everybody
is free to free the memory but not automatically from an EbmlMaster. It serves
our needs for the moment and keep the solution easy.
http://www.matroska.org



More information about the Matroska-devel mailing list