[3/4] jscript: Fix various memory and reference count leaks.

Rob Shearman robertshearman at gmail.com
Thu Dec 31 06:17:04 CST 2009

2009/12/30 Jacek Caban <jacek at codeweavers.com>:
> Hi Rob,
> Thanks for your work on jscript. Unfortunately fixing Valgrind on jscript is
> not going to be easy. Most of your fixes are good, except clear_global part
> and "jscript: Fix a circular reference caused by object and function objects
> being able to have properties that are objects and functions." patch. I've
> sent a test showing that Windows doesn't do that.

I've resent the memory leak patch without the clear_global part.

> To fix it properly we need
> to implement a garbage collector. I've designed it in the very early days of
> jscript, but I never had time to implement it.

That sounds like an excellent piece of work for someone interested in
algorithms as opposed to the usual bug fixing. I don't think I have
the time to follow through on this myself at the moment.

I can see how this would work for solving the general problem of
circular reference counts in jscript. However, I don't see how this
helps for managing the lifetime of global objects. It seems that
either the global constructors have state in which case they need to
be around for as long as the script context is, while not holding a
reference to the script context to avoid preventing it from dying, or
they don't have any state in which case they can be constructed lazily
and destroyed when the last reference is removed.

Rob Shearman

More information about the wine-devel mailing list