Re: [Vala] reference management.

On Die, 2007-03-20 at 07:18 +0100, Mathias Hasselmann wrote:
Currently all member variables are strongly referenced by default. To
make them weak add exactly this keyword. For local variables currently
some heuristics exist. Weak still is preferred, but there are some
thoughts to use always use strong references for local variables.
Problem with strong references on local variables: Whilst strong
references are quite cheap to maintain for GObject derived classes,
they can be extremely expensive for things like boxed types or GList.

I've removed the heuristic from Vala SVN; local variables default to
strong references now. The compiler will warn if it has to copy
structures without support for reference counting as that might cause
side-effects and might also be expensive for some types. You can still
explictly specify local variables to be weak, so that you can optimize
critical code parts if necessary.

We intend to add a full garbage collector to Vala which can be used as
alternative to reference counting as far as possible with GObject. This
might improve performance without manually marking weak references.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]