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

Ronald Bultje rbultje at ronald.bitfreak.net
Tue Feb 25 17:03:18 CET 2003


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.

Ronald

-- 
Ronald Bultje <rbultje at ronald.bitfreak.net>
Linux Video/Multimedia developer

http://www.matroska.org



More information about the Matroska-devel mailing list